Pps Practical File
Pps Practical File
#include <stdio.h>
int main()
{
int a, b;
printf("Enter the value of a\n");
scanf("%d", &a);
return 0;
}
2. Write a program to find area of triangle(a=h*b*.5)
a = area
h = height
b = base
#include <stdio.h>
int main()
{
float base, height;
printf("Enter the length of the base in 'cm':\n");
scanf("%f", &base);
return 0;
}
3. Write a program to calculate simple interest (i = (p*r*n)/100 )
i = Simple interest
p = Principal amount
r = Rate of interest
n = Number of years
#include <stdio.h>
int main()
{
float principal, rate, year;
return 0;
}
4. Write a C program to interchange two numbers.
5. Write a C program to enter a distance in to kilometre and convert it in to meter, feet, inches and
centimeter
6. Write a program to compute Fahrenheit from centigrade (f=1.8*c +32)
#include <stdio.h>
int main()
{
float centigrade;
return 0;
}
7. Write a C program to find out distance travelled by the equation d = ut + at^2
#include <stdio.h>
int main()
{
int distance, accleration, time, initial_velocity;
return 0;
}
8. Write a C program to find that the accepted number is Negative, or Positive or Zero.
#include <stdio.h>
int main()
{
int a;
printf("Enter a numbers:\n");
scanf("%d", &a);
if (a > 0)
{
printf("%d is a positive number.\n", a);
}
else if (a < 0)
{
printf("%d is a negative number.\n", a);
}
else if (a == 0)
{
printf("%d is a Zero.\n", a);
}
return 0;
}
9. Write a program to read marks of a student from keyboard whether the student is pass or fail( using
if else)
10. Write a program to read three numbers from keyboard and find out maximum out of these three.
(nested if else)
#include <stdio.h>
int main()
{
int a, b, c ;
printf("Enter four no. of your choice.\n");
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
if (a > b)
{
if (a > c)
{
printf("\n");
printf("%d is the biggest.\n", a);
}
}
else if (b > c)
{
printf("\n");
printf("%d is the biggest.\n", b);
}
else
{
printf("\n");
printf("%d is the biggest.\n", c);
}
return 0;
}
11. Write a C program to check whether the entered character is capital, small letter, digit or any
special character.
#include <stdio.h>
int main()
{
char ch;
printf("Enter your character.\n");
scanf("%c", &ch);
Marks Grade
100 - 80 Distinction
79 - 60 First Class
59 - 40 Second Class
< 40 Fail
#include <stdio.h>
int main()
{
int Marks;
printf("Enter your obtained Marks between (0-100).\n");
scanf("%d", &Marks);
i * ii * iii *****
* * * * ****
* * * * * * ***
* * * * * * * * **
***********
30. Write a program to print following patterns :
12 1234 4444 22
1234 12 22 4444
12345 1 1 55555
31. Write a program to print following patterns:
i AAAAA ii ABCDE
BBBB ABCD
CCC ABC
DD AB
EA
32. Write a C 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 or odd from list of 10 numbers using array
34. Write a program to find maximum element from 1-Dimensional array.
35. Write a C program to calculate the average, geometric and harmonic mean of n elements in an
array.
36. Write a program to sort given array in ascending order (Use Insertion sort, Bubble sort, Selection
sort, Mergesort, Quicksort, Heapsort).
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 string.
41. Write a program to convert string into upper case
42. Write a program that defines a function to add first n numbers.
43. Write a function in the program to return 1 if number is prime otherwise return 0
44. Write a function Exchange to interchange the values of two variables, say x and y. illustrate the
use of this function in a calling function.
45. Write a C program to use recursive calls to evaluate F(x) = x – x3 / 3! + x5 / 5 ! – x7 / 7! + … xn/ n!.
46. Write a program to find factorial of a number using recursion.
47. Write a C program using global variable, static variable.
48. Write a function that will scan a character string passed as an argument and convert all lowercase
character into their uppercase equivalents
49. Write a program to read structure elements from keyboard.
50. Define a structure type struct personal that would contain person name, date of joining and salary
using this structure to read this information of 5 people and print the same on screen.
51. Define structure data type called time_struct containing three member’s integer hour, integer
minute and integer second. Develop a program that would assign values to the individual number and
display the time in the following 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