PPS

Programs of Programming for Problem Solving using C language.

1.Write a program that perform as calculator( Addition, Multiplication, division, subtraction).
 Solution            
2.Write a program to find area of triangle using formula a = h*b*0.5.
             where,
             a - area of triangle
             h - height of triangle and
             b - length of base of triangle
3. Write a program to calculate simple interest(i= p*r*n/100).
             where,
              i - simple interest
              p - principal amount
              r - Rate of interest
              n - Number of years
4. Write a C program to interchange two numbers.
using 3rd variable                                  without using 3rd variable
5. Write a C program to enter a distance in kilometers and convert it into meter, feet, inches, and centimeter.
6. Write a program to convert temperature in centigrade into Fahrenheit(f=1.8*c + 32).

7. Write a program to find out distance traveled by an object using the equation  d = u*t + 0.5*a*t*t.
where,
          d - distance traveled
          u - initial velocity
          a - acceleration
          t - time taken
8. Write a program to find that the accepted number is positive, Negative or Zero.
9. Write a program to read marks of a student from keyboard and print whether he/she is pass or fail.
 10. Write a program to read three numbers from keyboard and find out maximum out of that numbers.
11. Write a program to check whether the entered character is capital, small letter, digit or any special character.
12. Write a program to read marks from keyboard and your program should display equivalent grade according to following criteria.
                marks                       Grade
           100-80                         Distinction
           79-60                           First Class
           59-40                           Second Class
           < 40                             Fail
 13. Write a program to prepare pay slip using following data.
Da = 10% of basic, Hra = 7.50% of basic, Ma = 300, Pf = 12.50% of basic,
Gross = basic + Hra + Da + Ma, Nt = Gross - Pf.
14. Write a C program to read no. 1 to 7 and print relatively day Sunday to Saturday.
15. Write a C program to find out maximum and minimum number from given 10 numbers.
16.Write a program to input an integer number and check the last digit of number is even or odd.
17. Write a C program to find factorial of given number.
18. Write a program to reverse a given number.
19. Write a program to generate first n numbers of Fibonacci series. ( 0,1,1,2,3,5,8,13,.........)
20. Write a program to find sum of first and last digit of given number.
21. Write a C program to find sum and average of different numbers which are entered by the user as many as user want.
22.Write a program to calculate average and total of 5 students for 3 subjects(using nested for loop).
23. Read five persons height and weight and count the number of persons having height greater than 170 and weight less than 50.
24. Write a program to check whether the given number is prime or not.
25. Write a program to evaluate the series 1^2 + 2^2 + 3^2 +..................+ n^2.
26. Write a program to find 1 + 1/2 + 1/3 + 1/4 + 1/5 +..........................+ 1/n.
27. Write a C program to find 1 + 1/2! + 1/3! + 1/4! +..........................+ 1/n!.
28. Write a program to evaluate the series 1 - x + x^2/2! - x^3/3! +............
29.  Write a program to print following patterns :
i)
*
* *
* * *
* * * *
* * * * *
Solution
ii)
    *
   * *
  * * *
 * * * *
* * * * *
Solution
iii)
*****
****
***
**
*
Solution
30. Write a program to print following patterns :

i) 
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Solution
ii)
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Solution
iii)
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
Solution
iv)
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Solution
31.    Write a program to print following patterns :

i)
A A A A A
B B B B
C C C
D D
E
Solution
ii)
A B C D E
A B C D
A B C
A B
A
Solution   
32.  Write a program to read and store the roll no and marks of 20 students using array.
33. Write a program to find out which number is even and odd from a list of 10 numbers using array.
34. Write a program to find maximum element from 1-Dimensional array.
35. Write a program to calculate the average, geometric mean, Harmonic mean of n elements of an array.
36. Write a program to sort given array in ascending order.
37. Write a program to find a character from given string.
38. Write a program to replace a character in given string.
39. Write a program to delete a character in given string.
40. Write a program to reverse given string.
41. Write a program to convert given string into upper case.
42. Write a program that defines a function to add first n numbers.
43. Write a Write a program to return 1 if given number is prime and or to return 0 if number is not prime.
44. Write a function exchange to interchange the values of two variables, say x and y. Illustrate the effect of this change in calling function.
45. Write a program to use recursive calls to evaluate f(x) = x - x^3/3! + x^5/5! - .................... x^n/n!.
46. Write a program to find factorial of a number using recursion.
47. Write a C program using Global variable, Static variable.
Global variable             Local variable
48. Write a function that will scan a character string passed as an argument and convert all lower case letters into their uppercase equivalents.

Solution
49. Write s program to read structure elements from keyboard.
50. Define a  structure type struct personal that would contain person name, date of joining and salary. Use this structure to read the information of 5 people and print the same on the screen.
51. Define a structure data type called time_struct containing three numbers integer hour, integer minute and integer second. Develop a program that would assign values to the individual number and display the time in the shown format:   16:40:51.
52. Define a structure called cricket that will describe the following information:
Player name
Team name
Batting average
Using cricket, declare an array player with 50 elements and write a C program to read the information about all the 50 players and print team wise list containing names of players with their batting average.
53. Design a structure student_record to contain name, branch and total marks obtained. Develop a program to read data for 10 students in a class and print them.
54. Write a program to print address of variable using pointer.
55. Write a C program to swap the two values using pointers.
56.Write a C program to print the address of character and the character of string using pointer.
57. Write a program to access elements using pointer.
58. Write a program for sorting using pointer.
59. Write a program to write a string in file.
60. A file named data contains series of integer numbers. Write a c program to read all numbers from file and then write all odd numbers into file named “odd” and write all even numbers into file named “even”. Display all the contents of these file on screen.     

Comments

YouTube

Popular posts from this blog

GTU PPS Program - 15

Vim Text Editor

GTU PPS Program - 11