Easy and simple way to make an program to get the average marks using Array

  • #include<stdio.h>

  • #include<conio.h>

  • int main() {
  •     int avg, i, sum = 0;
  •     int marks[5];
  •     clrscr();
  •     for (i = 0; i <= 4; i++) {
  •         printf("Enter the marks of subject\n");

  •         scanf("%d", & marks[i]);
  •     }
  •     for (i = 0; i <= 4; i++)
  •         sum = sum + marks[i];
  •         avg = sum / 5;
  •         printf("average marks= %d%\n", avg);

  •         getch();

  •         return 0;
  • }  


output:

 



















Post a Comment

thank u so much
love 3

Previous Post Next Post