Can you create a program that will store and calculate the sum of 5 numbers entered by the user using arrays?
In C Programming Language.
How can we create a array program to store and calculate the sum of 5 numbers entered by the user.
I will show you how can you do it.
Steps:-
Step 1:- Read the array size and store it in a variable.
Step 2:- Take a variable sum. The sum variable add the all element in the array and you always remember the sum variable start with 0 value. if you take the sum value ‘1′ the expected output will increase by 1.
Step 3:- scanf function read the entered element and store in the the array variable a[ i ] . by using for loop.
Step 4:- take i variable which is used for “for loop”.
Let’s See an example of it:-
Comments
Post a Comment