+ 9
I want to create a calculator which can calculate percentage of student
In That calculator I want to use for loop for taking input as much the number of subject for eg:- 3 //number of subjects Enter the marks of the student 67 // I want to take input using for loop 77 88 = Answer
2 Answers
+ 17
run a loop n times
//take user input n times and add that to a variable sum
//now print(sum/n);
+ 3
This solution need a workaround in sololearn if you want to get the marks as array.
Here is a code which shows how to get a user-defined array in terms of size and values:
https://code.sololearn.com/cuXW5p4b5MJ2/?ref=app
first input is the size you want and the next ones are the actual values.
you can enter them like this:
5
23 13 67 99 17
now your program would have an array which you can access to make your calculations