write a C program which asks the user to input the marks to physics,chemistry, and Math. Then calculate the percentage and print on the screen.
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int phy, che, mat, tot;
- float per;
- clrscr();
- printf("\n Enter the marks of physics: ");
- scanf("%d",&phy);
- printf("\n Enter the marks of Chemistry: ");
- scanf("%d",&che);
- printf("\n Enter the marks of Mathematics: ");
- scanf("%d",&mat);
- tot=phy+che+mat;
- per=tot/3.0;
- printf("\n The percentage is: %f",per);
- getch();
- }
- output:
- Enter the marks of physics: 60
- Enter the marks of physics: 65
- Enter the marks of physics: 63
- The percentage is: 62.666668
0 Comments