0% found this document useful (0 votes)
11 views4 pages

PGM 1,2,3

Uploaded by

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

PGM 1,2,3

Uploaded by

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

1.

Write a C Program to read radius of a


circle and to find area and circumference.
#include<stdio.h>
#include<conio.h>
void main()
{
float r,area,circum;
clrscr();
printf("Enter the radius: ");
scanf("%f",&r);
area=3.14*r*r;
circum=2*3.14*r;
printf("Area is %.2f\n",area);
printf("Circumference is %.2f\n",circum);
getch();
}

Ouput:
Enter the radius : 3
Area is 28.26
Circumference is 18.84
2. Write a C Program to read three numbers
and find the biggest of the three numbers

#include<stdio.h>
#include<conio.h>
void main()
{
int n1,n2,n3;
clrscr();
printf("Enter three numbers: ");
scanf("%d %d %d",&n1,&n2,&n3);
if(n1>n2 && n1>n3)
printf("%d is the largest number",n1);
else if(n2>n1 && n2>n3)
printf("%d is the largest number",n2);
else
printf("%d is the largest number",n3);
getch();
}

Ouput:
Enter three numbers: 23 43 11
43 is the largest number

3. Write a C Program to read percentage of


marks and to display appropriate message
(Demonstration if else-if ladder
#include<stdio.h>
#include<conio.h>
void main()
{
float per;
clrscr();
printf("Enter the percentage of marks: ");
scanf("%f",&per);
if(per>=75)
printf("DISTINCTION");
else if(per>=60)
printf("FIRST CLASS");
else if(per>=50)
printf("SECOND CLASS");
else if(per>=40)
printf("THIRD CLASS");
else
printf("FAILED");

getch();
}
Ouput:
Enter the percentage of marks: 65
FIRST CLASS

You might also like