Experiment - 1-Wps Office
Experiment - 1-Wps Office
#include<stdio.h>
#include<conio.h>
void main()
printf("Rana Dhruv");
getch();
}
2).write a program to that program as calculator (addition,subtraction, multiplication,
division).
#include<stdio.h>
#include<conio.h>
int main()
intx,y;
clrscr();
scanf ("%d%d",&x,&y);
printf("%d+%d %d\n",x,y,x+y);
printf("%d-%d=%d\n",x,y,x-y);
printf("%d %d %d\n",x,y,x*y);
printf("%d/%d=%d\n",x,y,x/y);
getch();
}
3).write a program to calculate simple interest(i=P*R*N/100).
#include <stdio.h>
#include <conio.h>
int main()
int p, r, n;
float i;
scanf("%d", &P);
scanf("%d", &R);
scanf("%d", &N);
i = (P*R*N) / 100;
return 0;
}
4).write a program to find the area of triangle(a=h*b*0.5).
#include <stdio.h>
#include <conio.h>
int main()
int h, b;
float a;
scanf("%d", &h);
scanf("%d", &b);
a = 0.5 * h * b;
getch();
}
1).Write a C program to read and store the roll no and marks of 20 students using array.
#include <stdio.h>
#include <conio.h>
int main()
scanf("%d", &rollno[i]);
scanf("%d", &marks[i]);
printf("\nStudent Records:\n");
getch();
return 0;
}
2).Write a program to find out which number is even or odd from.
#include <stdio.h>
int main()
int i, a[10];
scanf("%d", &a[i]);
if(a[i] % 2 == 0)
else
printf("%d is an odd number\n", a[i]);
return 0;
}
3).Write a C program to calculate the average, geometric and harmonic mean of
n elements in an array.
#include<stdio.h>
#include<math.h>
int main()
float a[50],s=0,s1=0,s2=1;
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%f",&a[i]);
s=s+a[i];
s1=s1+(1.0/a[i]);
s2=s2*a[i];
printf("\ngeometric mean=%f",pow(s2,(1.0/n)));
return 0;