C percentage program
Here is an example of a C program that calculates the percentage:
#include <stdio.h>
int main() {
float obtained_marks, total_marks, percentage;
printf("Enter obtained marks: ");
scanf("%f", &obtained_marks);
printf("Enter total marks: ");
scanf("%f", &total_marks);
percentage = (obtained_marks / total_marks) * 100;
printf("Percentage: %.2f%%\n", percentage);
return 0;
}
This program prompts the user to enter the obtained marks and total marks, calculates the percentage using the formula (obtained_marks / total_marks) * 100
, and then prints the result.
Please note that personal words or sentences are not included in this response.