0

Please help me. I am a bigginer. I want to take marks as input from user in this code. So How can I do this?

#include<stdio.h> int main() { int i; int total_marks[]={86,78,94,68,92,78,64,62,72,61,72,65,80,72,62,68,66,65,81,62,56,68,58,56,82,70,74,67,62,76,70,78,76,84,88,73,65,77,63}; int marks_count[101]; for(i=0;i<101;i++){ marks_count[i]=0; } for(i=0;i<40;i++){ marks_count[total_marks[i]]++;} for(i=50;i<=100;i++){ printf("Marks:%d Count %d\n",i,marks_count[i]); } return 0; }

22nd May 2020, 10:36 PM
Tamzid Hasan
Tamzid Hasan - avatar
4 Answers
+ 1
int total_marks[40]; for(int i=0; i <40; i++){ scanf("%d", &total_marks[i]); }
23rd May 2020, 9:32 AM
Jnn
Jnn - avatar
+ 1
Thank you so much. Actually I couldn’t declare scanf function at array that time. Btw thank you againđŸ€—
23rd May 2020, 9:37 AM
Tamzid Hasan
Tamzid Hasan - avatar
0
You can get user input with scanf for example
22nd May 2020, 11:09 PM
Jnn
Jnn - avatar
0
I know but here how can I use?
23rd May 2020, 2:10 AM
Tamzid Hasan
Tamzid Hasan - avatar