Professional Documents
Culture Documents
Luv Pps
Luv Pps
Luv Pps
Luv 1 22010001029
Gateway Institute of Engineering and Technology (GIET)
INDEX
S. NO. Program List Signature
1. Write a program to compute the average of three numbers ?
2. Write a program to find the area of circle ?
3. Write a program to find the simple interest ?
4. Write a program to find volume of cylinder ?
5. Write a program check weather a number is even or odd ?
6. Write a program to check the entered year is a leap year or not ?
7. Write a program to find greater of three numbers ?
8. Write a program to check weather a number is positive, negative
or zero ?
9. Write a program to check a number is divisible by both 3 and 5 ?
10. Write a program to find sum of squares upto user’s input ?
11. Write a program to find sum of series (1+3+5+……….+19) ?
12. Write a program to find sum of series (1+4+7+………..+25) ?
13. Write a program to find cube of even numbers upto user’s input ?
14. Write a program to find factorial of the given number ?
15. Write a program to find sum of two matrix ?
Luv 2 22010001029
Gateway Institute of Engineering and Technology (GIET)
PROGRAM – 1
1. Write a program to compute the average of three numbers ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a,b,c;
float average;
scanf("%d%d%d",&a,&b,&c);
average=(a+b+c)/3;
printf("average of no is %f",average);
getch();
return0;
OUTPUT :
Luv 3 22010001029
Gateway Institute of Engineering and Technology (GIET)
PROGRAM – 2
2. Write a program to find the area of circle ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int r;
float area;
scanf("%d",&r);
area=3.14*r*r;
Luv 4 22010001029
Gateway Institute of Engineering and Technology (GIET)
getch();
return 0;
OUTPUT :
PROGRAM – 3
3. Write a program to find the simple interest ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int p,r,t;
float simple_interest;
printf("\nenter principle\n");
scanf("%d",&p);
Luv 5 22010001029
Gateway Institute of Engineering and Technology (GIET)
printf("enter rate\n");
scanf("%d",&r);
printf("enter time\n");
scanf("%d",&t);
simple_interest=(p*r*t)/100;
getch();
return 0;
OUTPUT :
PROGRAM – 4
4. Write a program to find volume of cylinder ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
Luv 6 22010001029
Gateway Institute of Engineering and Technology (GIET)
int main()
int r;
float volume;
scanf("%d",&r);
volume=4/3*3.14*r*r*r;
getch();
return 0;
OUTPUT :
PROGRAM – 5
5. Write a program check weather a number is even or odd ?
SOURCE CODE :
#include<stdio.h>
Luv 7 22010001029
Gateway Institute of Engineering and Technology (GIET)
#include<conio.h>
int main()
int a,i;
scanf("%d",&a);
i=a%2;
if(i==0){
printf("the no is even");}
else{
printf("the no is odd");}
getch();
return 0;}
OUTPUT :
PROGRAM – 6
Luv 8 22010001029
Gateway Institute of Engineering and Technology (GIET)
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a,b;
printf("\nenter a year\n");
scanf("%d",&a);
b=a%4;
if(b==0){
else{
getch();
return 0;}
OUTPUT :
Luv 9 22010001029
Gateway Institute of Engineering and Technology (GIET)
PROGRAM – 7
7. Write a program to find greater of three numbers ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a,b,c;
printf("\nenter 3 no \n");
scanf("%d%d%d",&a,&b,&c);
printf("a is grater");}
Luv 10 22010001029
Gateway Institute of Engineering and Technology (GIET)
else{
printf("wrong choice");}
getch();
return 0;
OUTPUT :
PROGRAM – 8
8. Write a program to check weather a number is positive, negative or zero ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a;
printf("\nenter a no \n");
Luv 11 22010001029
Gateway Institute of Engineering and Technology (GIET)
scanf("%d",&a);
if(a>0){
printf("the no is +ve");
if(a<0){
printf("the no is -ve");
if(a==0){
printf("the no is zero");}
getch();
return 0;
OUTPUT :
PROGRAM – 9
9. Write a program to check a number is divisible by both 3 and 5 ?
Luv 12 22010001029
Gateway Institute of Engineering and Technology (GIET)
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a;
printf("\nenter a no \n");
scanf("%d",&a);
else{
getch();
return 0;}
OUTPUT :
PROGRAM – 10
Luv 13 22010001029
Gateway Institute of Engineering and Technology (GIET)
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a,i,j,k;
k=0;
i=1;
scanf("%d",&a);
while(i<=a){
j=i*i;
printf("square of no %d is %d\n",i,j);
k=k+j;
i=i+1;
getch();
return 0;
OUTPUT :
Luv 14 22010001029
Gateway Institute of Engineering and Technology (GIET)
PROGRAM – 11
11. Write a program to find sum of series (1+3+5+……….+19) ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a,i,s;
s=0;
i=1;
while(i<=20){
s=s+i;
i=i+2;}
printf("is %d",s);
Luv 15 22010001029
Gateway Institute of Engineering and Technology (GIET)
getch();
return 0;}
OUTPUT :
PROGRAM – 12
12. Write a program to find sum of series (1+4+7+………..+25) ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a,i,s;
s=0;
i=1;
Luv 16 22010001029
Gateway Institute of Engineering and Technology (GIET)
while(i<=25){
s=s+i;
i=i+3;}
printf("is %d",s);
getch();
return 0;}
OUTPUT :
PROGRAM – 13
13. Write a program to find cube of even numbers upto user’s input ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int a,i,j,k;
k=0;
Luv 17 22010001029
Gateway Institute of Engineering and Technology (GIET)
i=0;
scanf("%d",&a);
while(i<=a){
j=i*i*i;
k=k+j;
i=i+2;
getch();
return 0;
OUTPUT :
Luv 18 22010001029
Gateway Institute of Engineering and Technology (GIET)
PROGRAM – 14
14.Write a program to find the factorial of a number ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int i,a,factorial;
factorial=1;
printf("\nfactorial of number\n");
scanf("%d",&a);
for(i=a;i>=1;i--){
factorial=factorial*i;
printf("%d",factorial);
getch();
return 0;
OUTPUT :
Luv 19 22010001029
Gateway Institute of Engineering and Technology (GIET)
PROGRAM – 15
15.Write a program find the sum of two matrix ?
SOURCE CODE :
#include<stdio.h>
#include<conio.h>
int main()
int i,j,matrix1[20][20],a,b,matrix2[20][20],matrix3[20][20];
printf(“\nenter no of rows\n”);
scanf(“%d”,&a);
printf(“enter no of columns\n”);
scanf(“%d”,&b);
for(i=1;i<=a;i++){
for(j=1;j<=b;j++){
Luv 20 22010001029
Gateway Institute of Engineering and Technology (GIET)
scanf(“%d”,&matrix1[i][j]);
printf(“\n”);
for(i=1;i<=a;i++){
for(j=1;j<=b;j++){
scanf(“%d”,&matrix2[i][j]);
printf(“\n”);
for(i=1;i<=a;i++){
for(j=1;j<=b;j++){
matrix3[i][j]=matrix1[i][j]+matrix2[i][j];
printf(“%d\t”,matrix3[i][j]);
printf(“\n”);
getch();
return 0;
OUTPUT :
Luv 21 22010001029
Gateway Institute of Engineering and Technology (GIET)
Luv 22 22010001029