C PROGRAMMING

write a c program to calculate percentage of marks obtained by a student

	#include <stdio.h>
int main()
{
int cLan, data_structures, operating_system, software_engineering, computer_organisation;
float total, average, percentage;

/* Input marks of all five subjects */
printf("Enter marks of five subjects: n");
printf("Enter marks of C language: n");
scanf("%d", &cLan);

printf("Enter marks of data structures n");
scanf("%d", &data_structures);

printf("Enter marks of operating system n");
scanf("%d", &operating_system);

printf("Enter marks of software engineering n");
scanf("%d", &software_engineering);

printf("Enter marks of computer architecture and organisation n");
scanf("%d", &computer_organisation);


/* Calculate total, average and percentage */
total = cLan + data_structures + operating_system + software_engineering + computer_organisation;
average = total / 5.0;
percentage = (total / 500.0) * 100;

/* Print all results */
printf("Total marks = %.2fn", total);
printf("Average marks = %.2fn", average);
printf("Percentage = %.2f", percentage);
return 0;
getch();
}
Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button