0% found this document useful (0 votes)
22 views

Prelims of 10th

Prelims

Uploaded by

seemamini27
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Prelims of 10th

Prelims

Uploaded by

seemamini27
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

‘C’ Programs for Std.

- X

//Prog 1: Convert metre into millimetre //Prog 2: Find area of rectangle

Answer: Answer:
//Progrm to convert metre into millimetre //Program to find area or rectangle
#include<stdio.h> #include<stdio.h>
int main() int main()
{ {
float m, mm; float l,b,a;
printf("Enter Meter "); printf("Enter Length ");
fflush(stdout); fflush(stdout);
scanf("%f",&m); scanf("%f",&l);
mm=m*1000; printf("Enter breath ");
printf("Millimeter = %.2f",mm); fflush(stdout);
} scanf("%f",&b);
a=l*b;
printf("Area of rectangle = %.2f",a);
}

//Prog 3: Find area or circle //Prog 4: Find average of 3 numbers

Answer: Answer:
//Program to find area of circle //Program to find average of 3 numbers
#include<stdio.h> #include<stdio.h>
#define PI 3.14 int main()
int main() {
{ float n1,n2,n3,avg;
float r,a; printf("Enter 1st No. ");
printf("Enter Radius "); fflush(stdout);
fflush(stdout); scanf("%f",&n1);
scanf("%f",&r); printf("Enter 2nd No. ");
a=PI*r*r; fflush(stdout);
printf("Area of circle is %.2f",a); scanf("%f",&n2);
} printf("Enter 3rd No. ");
fflush(stdout);
scanf("%f",&n3);
avg=(n1+n2+n3)/3;
printf("Average of Nos = %.2f",avg);
}
//Prog 5: Display Pass or Fail //Prog 6: Print first ten numbers using
FOR loop
Answer:
//Program to display Pass or Fail Answer:
#include<stdio.h> //Program to print first ten numbers
int main() #include<stdio.h>
{ int main()
float marks; {
printf("Enter Marks "); int i;
fflush(stdout); for(i=1; i<=10; i++)
scanf("%f",&marks); printf("%d\n", i);
if(marks>=33) }
printf("You are Pass");
else
printf("You are Fail");
}

//Prog 7: Find simple interest

Answer:
//Program to find simple interest
#include<stdio.h>
int main()
{
float p, r, t, s;
printf("Enter Principle ");
fflush(stdout);
scanf("%f",&p);
printf("Enter Rate ");
fflush(stdout);
scanf("%f",&r);
printf("Enter Time ");
fflush(stdout);
scanf("%f",&t);
s=p*r*t/100;
printf("Simple Interest = %.2f",s);
}

You might also like