Program to calculate sum of 5 subjects and find percentage.

इस प्रोग्राम में हम यह जानेगे कि किस प्रकार हम C प्रोग्रामिंग का प्रयोग करके 5 विषयों के पूर्णांको में से प्राप्त प्राप्तांक को जोड़ कर उनका प्रतिशत निकालेगे, जिसके लिए हम यूजर से 5 विषयों के प्राप्तांको को इनपुट करा लेगे और उन प्राप्तांको के मदद से प्रतिशत प्राप्त कर लेगे |

#include<stdio.h>
#include<conio.h>
void main()
{
  int s1,s2,s3,s4,s5,sum,total=500;
  float per;
  clrscr();
  printf("enter marks of 5 subjects: ");
  scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);
  sum=s1+s2+s3+s4+s5;
  printf("\nsum=%d",sum);
  per=(sum*100)/total;
  printf("\npercentage=%f",per);
  getch();
}

Output:
enter marks of 5 subjects: 50
55
60
65
70
sum=300
percentage=60.000


Comments are closed.

error: Content is protected !!