اذهب إلى المحتوى

Sher.

الأعضاء
  • المساهمات

    1
  • تاريخ الانضمام

  • تاريخ آخر زيارة

إنجازات Sher.

عضو مبتدئ

عضو مبتدئ (1/3)

0

السمعة بالموقع

  1. Hello,i'm learning c and i have a problem with my cod. .i want to calculate the average for every exam, but it returns randomly numbers could you take a look i'm sorry for english, i dont have arabic keybord. #include<stdio.h> #include<stdlib.h> struct Student MStudent(struct Student std); void CalcAvrg(struct Student std); struct Student{ int mark[5][5]; }; struct Student MStudent(struct Student std){ int i,j; for(i=0;i<5;i++){ for(j=0;j<5;j++){ printf("%d. Student's mark for %d. exam :\n", i+1,j+1); scanf("%d", &std.mark[i][j]); } } return std; } void CalcAvrg(struct Student std){ int i; for(i=0;i<5;i++){ printf("%d. Exam's average is: %d\n", i+1, (std.mark[0][i] +std.mark[1][i] + std.mark[2][i]+ std.mark[3][i]+ std.mark[4][i])/5); } } int main(){ struct Student dene; MStudent(dene); CalcAvrg(dene); return 0; }
×
×
  • أضف...