#include <stdio.h> int main() { float subject1, subject2, subject3, subject4, average; /* Input marks of each subject from the user*/ printf( "Enter marks of subject 1: " ); scanf( "%f" , &subject1); printf( "Enter marks of subject 2: " ); scanf( "%f" , &subject2); printf( "Enter marks of subject 3: " ); scanf( "%f" , &subject3); printf( "Enter marks of subject 4: " ); scanf( "%f" , &subject4); /* Calculate average marks*/ average = (subject1 + subject2 + subject3 + subject4) / 4; /* Display the average marks*/ printf( "The average marks of the four subjects is: %.2f\n" , average); return 0; }
Comments
Post a Comment