Most Important Programs of CPS Theory Exam
Most Important Programs of CPS Theory Exam
Expected
Sl.No. Name of the program
marks
Write a C-program to calculate the simple interest where principal, amount,
1 6
time and rate of interest is given.
Develop a C-program to implement commercial calculator simple
2 arithmetic operations such as addition, subtraction, multiplication and 8
division and display the result of arithmetic operation on screen.
Develop a C-program to compute the roots of a quadratic equation by
3 8
accepting the coefficients. Print appropriate messages.
Develop a C-program to construct following pattern.
*
**
4 6
***
****
*****
Write a C-program to search the given element present in the list using
5 6
linear searching algorithm.
6 Write a C-program to transpose a matrix 6
Write a program in C to find the factorial of a given number using recursive
7 6
function.
8 Develop a C-program to find the Fibonacci series for a given value of ‘n’. 8
Write a C-program to check whether the given number is prime number or
9 8
not and display appropriate message on the screen
Write a C-program to maintain record of ‘n’ students using structures with
10 fields (roll no, marks, name and grade). Print the names of students with 8
marks>=70.
Write a program in C to display the grade based on the marks as follows:
Marks Grades
0 to 39 F
40 to 49 E
11 50 to 59 D 10
60 to 69 C
70 to 79 B
80 to 89 A
90 to 100 O
Write a program in C to check whether the given integer if palindrome or
12 8
not
13 Write a C program to find GCD of two numbers using functions 6
14 Develop a C program to plot a Pascal’s triangle 6
15 Write a C program to implement Bubble sort technique (ascending order). 8
Define a structure by name DoB consisting of three variable members dd,
16 mm and yy of type integer. Develop a C program that would read values to 10
the individual member and display the date in mm/dd/yy form
17 Write a C program to swap two numbers. 6
*****************Best Wishes Form Our YouTube Channel*****************
1. PROGRAM TO CALCULATE THE SIMPLE INTEREST WHERE PRICIPAL AMOUNT,TIME
AND RATE OF INTEREST IS GIVEN(QUESTION PAPER: DEC./JAN. 2019)
#include<stdio.h>
void main()
{
int p,t;
float r,si;
printf("enter pricipal amount,time and rate of interest\n");
scanf("%d%d%f",&p,&t,&r);
si=(p*t*r)/100;
printf("the simple interest is %f\n",si);
}
#include<stdio.h>
int main()
{
int a[25],n,i,key ;
printf("Enter n:");
scanf("%d",&n);
printf("\n Enter any %d values",n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\n Enter item to be search:");
scanf("%d",&key);
for(i=0;i<n;i++)
{
if (key==a[i])
{
printf("\n Item found %d at %d position",a[i],i+1);
exit(0);
}
}
printf("\n Item not found!");
return 0;
}
for(j=0;j<4;j++)
{
scanf("%d",&A[i][j]);
}
}
printf("successfully stored\n");
printf("******ORIGINAL MATRIX*******\n");
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("%d\t",A[i][j]);
}
printf("\n");
}
printf("******TRANSPOSED MATRIX*******\n");
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("%d\t",A[j][i]);
}
printf("\n");
}
}
5. WRITE A PROGRAM TO CHECK WHETHER THE GIVEN NUMBER IS PRIME NUMBER OR NOT
AND DISPLAY APPROPRIATE MESSAGE ON THE SCREEN (QUESTION PAPER: JUNE/JULY
2019 AND JUNE/JULY 2019)
#include<stdio.h>
int n,i,flag=1;
void isprime(int n);
void main()
{
printf("\n Enter n:");
scanf("%d",&n);
isprime(n);
}
void isprime(int n)
{
for(i=2;i<n;i++)
{
if(n%i==0)
{
flag=0;
break;
}
}
if(flag ==1)
printf("\n %d is prime number",n);
else
printf("\n %d is not prime number",n);
}
void main()
{
printf("Enter the number of students\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Enter the details of %d students\n",i);
printf("Enter the Rollno\n");
scanf("%d",&s[i].Rollno);
printf("Enter the Name\n");
scanf("%s",s[i].Name);
printf("Enter the Marks\n");
scanf("%d",&s[i].Marks);
printf("Enter the Grade\n");
s[i].G=getche();
printf("\n");
}
printf("The names of students with Marks>=70 are as follows\n");
for(i=1;i<=n;i++)
{
if(s[i].Marks>=70)
{
#include<stdio.h>
void main()
{
int marks;
printf("Enter your marks ");
scanf("%d",&marks);
if(marks<0 || marks>100)
{
printf("Wrong Entry");
}
else if(marks<=39)
{
printf("Grade F");
}
else if(marks>=40 && marks<=49)
{
printf("Grade E");
}
else if(marks>=50 && marks<=59)
{
printf("Grade D");
}
else if(marks>=60 && marks<=69)
{
printf("Grade C");
}
else if(marks>=70 && marks<79)
{
printf("Grade B");
}
else if(marks>=80 && marks<=89)
{
printf("Grade A");
}
else
{
printf("Grade O");
}
}
#include <stdio.h>
int main() {
int n, reversed = 0, remainder, original;
printf("Enter an integer: ");
scanf("%d", &n);
original = n;
return 0;
}
#include<stdio.h>
int main()
{
int n1, n2, i, gcd;
return 0;
}