Advertisement
anonymzz

Untitled

Mar 11th, 2023
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. // start the main function
  4. int main(void) {
  5.  
  6.     int mark1, mark2; // for two subjects marks
  7.     float avg; // average
  8.  
  9.     // get first subject mark
  10.     printf("Enter subject 1 mark : ");
  11.     scanf("%d", &mark1);
  12.     // get second subject mark
  13.     printf("Enter subject 2 mark : ");
  14.     scanf("%d", &mark2);
  15.  
  16.     // calculate average of marks
  17.     avg = (mark1 + mark2) / 2.0;
  18.  
  19.     // display average
  20.     printf("Your average = %.2f", avg);
  21.  
  22.     return 0;
  23.  
  24. } // end of main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement