Professional Documents
Culture Documents
J . K . M . ___________
10 - EARTH
Pr3. Take a value from the user and Addition of their two values
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
c=a+b;
printf("Addition=%d",c);
getch();
}
Pr4. Take a value from the user and Addition of their two values
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
c=a+b;
printf("Addition=%d",c);
getch();
}
Pr5. Take a value from the user and Swapping the values.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("Value of a=%d",a);
printf("Value of b=%d",b);
getch();
}
Pr6. Take a value from the user and perform simple intrest.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int p,r,n;
float i;
printf("Enter price=");
scanf("%d",&p);
printf("Enter rate=");
scanf("%d",&r);
printf("Enter Duration=");
scanf("%d",&n);
i=p*r*n/100;
printf("Simple intrest=%.2f",i);
getch();
}
Pr7. Take a value from the user and find area of room.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int len,wid,area;
printf("Enter Length=");
scanf("%d",&len);
printf("Enter Width=");
scanf("%d",&wid);
area=len*wid;
printf("Area of room =%d",area);
getch();
}
Pr8. Take a value from the user and find average of given marks.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int mat,sci,ss,tot;
float per;
printf("Enter Marks out of 100=");
printf("Maths=");
scanf("%d",&mat);
printf("Science=");
scanf("%d",&sci);
printf("Social Science=");
scanf("%d",&ss);
tot=mat+sci+ss;
per=tot/3;
printf("Total Marks =%d",tot);
printf("Percentage =%.2f",per);
getch();
}