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

WAP To Print The Number of Boys and Girls in Class and Their Average

The document contains code for 4 programs: 1) A program to input the number of boys and girls in a class and their average marks, and output the total counts and average of a given student. 2) A program to calculate the circumference and area of a circle given its radius. 3) A program to input marks in 4 subjects, calculate total, average and grade of a student. 4) A program to calculate the area of a triangle using Hero's formula given 3 sides.

Uploaded by

Jaipal Sidhu
Copyright
© Attribution Non-Commercial (BY-NC)
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)
88 views

WAP To Print The Number of Boys and Girls in Class and Their Average

The document contains code for 4 programs: 1) A program to input the number of boys and girls in a class and their average marks, and output the total counts and average of a given student. 2) A program to calculate the circumference and area of a circle given its radius. 3) A program to input marks in 4 subjects, calculate total, average and grade of a student. 4) A program to calculate the area of a triangle using Hero's formula given 3 sides.

Uploaded by

Jaipal Sidhu
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 8

//WAP to print the number of boys and girls in class and their average.

#include<iostream.h> #include<conio.h> void main() { int n,i,male=0,female=0,m1,m2,m3,avg[10],roll; char ch; clrscr(); cout<<"\n Enter Total Number Of Students:"; cin>>n; for(i=1;i<=n;i++) { cout<<"\n Enter M For Male & F For Female: "; cin>>ch; if(ch=='m'||ch=='M') { cout<<"\n Enter Roll Number="<<i; cout<<"\n Enter Marks Of First Subject:"; cin>>m1; cout<<"\n Enter Marks Of Second Subject:"; cin>>m2; cout<<"\n Enter Marks Of Third Subject:"; cin>>m3; avg[i]=(m1+m2+m3)/3; male++;

} if(ch=='f'||ch=='F') { cout<<"\n Enter the marks of Roll number="<<i; cout<<"\n Enter Marks Of First Subject:"; cin>>m1; cout<<"\n Enter Marks Of Second Subject:"; cin>>m2; cout<<"\n Enter Marks Of Third Subject:"; cin>>m3; avg[i]=(m1+m2+m3)/3; female++; } }

cout<<"\n Total Male In Class:"<<male; cout<<"\n Total Female In Class:"<<female; cout<<"\n Enter The Roll Number To Access The Record:"; cin>>roll; for(i=1;i<=n;i++) { if(roll==i) { cout<<"\n Average of Roll No.:"<<roll<<" Is:"<<avg[i]; } } getch(); }

// WAP To Find The Circumference Of Circle

#include<iostream.h> #include<conio.h> void main() { int r; float area,circum; clrscr(); cout<<"\n Enter Radius:"; cin>>r; circum=2*3.142*r; area=3.142*r*r; cout<<"\n\n Circumference Of Circle Is:"<<circum; cout<<"\n\n The Area Of Circle Is:"<<area; getch(); }

//WAP to find the grede of a student using else-if.

#include<conio.h> #include<iostream.h> void main() { int math,eng,eco,pbi,total,avg; clrscr(); cout<<"\n Enter Marks In MATH:"; cin>>math; cout<<"\n Enter Marks In ENGLISH:"; cin>>eng; cout<<"\n Enter Marks In SCIENCE:"; cin>>eco; cout<<"\n Enter Marks In PUNJABI:"; cin>>pbi; total=math+eng+eco+pbi; avg=total/4; cout<<"\n\n Average ="<<avg; if(avg>=80) cout<<"\n\n A Grade"; else if(avg>=60&&avg<80) cout<<"\n\n B Grade"; else if(avg>=40&&avg<60) cout<<"\n\n C Grade"; else

cout<<"\n\n Fail"; getch(); }

//WAP To Print Area Of Triangle Using Hero'S Formula. #include<iostream.h> #include<conio.h> #include<math.h> void main() { float a,b,c; float s,area; clrscr(); cout<<"\n Enter First Side Of TRIANGLE:"; cin>>a; cout<<" Enter Second Side Of TRIANGLE:"; cin>>b; cout<<" Enter Third Side Of TRIANGLE:"; cin>>c; s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); cout<<"\n\n The Area Is: "<<area; getch(); }

You might also like