Académique Documents
Professionnel Documents
Culture Documents
#include<stdio.h>
void main()
clrscr();
int t,i,h;
scanf("%d",&t);
scanf("%d",&i);
scanf("%d",&h);
if (h>t&&h>i)
else
if(i>h&&i>t)
}
else
getch();
OUTPUT :
PROGRAM 2
2) Write a program largest out of 10 number entered by student .
#include<conio.h>
#include<stdio.h>
void main()
clrscr();
int t,i,h=0;
for(i=1;i<=10;i++)
scanf("%d",&t);
if (h>t)
h;
else
h=t;
getch();
}
OUTPUT :
PROGRAM 3
3) Write a program to find avreage of male and female height in a class.
#include<conio.h>
#include<stdio.h>
void main()
clrscr();
int t,i,h,sum1=0,sum2=0,f=0,m=0;
float avg1,avg2;
scanf("%d",&t);
for(i=1;i<=t;i++)
scanf("%d",&h);
if (h<6)
sum2 +=h;
++f;
else
++m;
avg1=sum1/m;
avg2=sum2/f;
getch();
}
OUTPUT :
PROGRAM 4
4) Write a program to find roots of quadratic equation.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
clrscr();
int a,c,b,D,x;
float x1,x2;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
D = b*b - 4*a*c;
printf("\n\n\n enter 1 : for if D > 0\n\n\nenter key 2 : if D == 0\n\n\n enter key 3 : if D <
0\n\n\n\n where x1 & x2 are roots ") ;
scanf("%d",&x);
switch (x)
{
case 1:
x1 = - b + sqrt(D)/2*a;
x2 = - b - sqrt(D)/2*a;
break;
case 2:
x1 = - b + sqrt(D)/2*a;
x2 = - b - sqrt(D)/2*a;
break;
case 3:
x1 = - b + sqrt(D)/2*a;
x2 = - b - sqrt(D)/2*a;
break;
default :
getch();
OUTPUT :
PROGRAM FILE
OF
FUNDAMENTAL COMPUTER
&
IN C
NAME : sachin
BRANCH : mechanical-a2
PROGRAMME : b.tech( 1 sem)
st
#include<conio.h>
void main()
int a,b,c,d,e,sum;
float average;
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
sum=a+b+c+d+e;
average=sum/5;
printf("sum is%d",sum);
printf("average=%f",average);
Output :
PROGRAM 6
1)Find the largest number out of three number.
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a>b&&a>c)
printf("a is largest");
else if(b>c)
printf("b is largest");
else
printf("c is lergest");
getch();
}
PROGRAM 7
1)Write a program multiple one matrix to another matrix.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main ()
int a[3][3],b[3][3],c[3][3];
int i,j,k;
for(i=1;i<=3;i++)
for(j=1;j<=3;j++)
scanf("%d",&a[i][j]);
for(i=1;i<=3;i++)
for(j=1;j<=3;j++)
scanf("%d",&b[i][j]);
for(i=1;i<=3;i++)
for(j=1;j<=3;j++)
{
c[i][j]=0;
for(k=1;k<=3;k++)
c[i][j]=c[i][j]+a[i][j]*b[k][j];
printf("\n\n\
%d",c[i][j]);
getch();