Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that asks the user how many numbers he/she wants to store. After

ID: 3567325 • Letter: W

Question

Write a program that asks the user how many numbers he/she wants to store. After you know how many numbers are to be stored ask the user for the numbers one at a time and store them in an array. Finally, display the sum of all multiples of 10 the user gave. You may assume all numbers will be zero or greater.

Your array must be the size specified by the user. The TA will check your source code to verify this.

Sample input/output

How many numbers? 5

Input number 1: 70

Input number 2: 8

Input number 3: 40

Input number 4: 25

Input number 5: 1

The sum of multiples of 10 is: 110

Explanation / Answer

#include<stdio.h>
int main(){
int n,sum=0,i;
printf("How many numbers? ");//asking for input
scanf("%d",&n);//taking input from terminal
int a[n];//declaring array according entered size
for(i=0;i<n;i++){//using for loop to take input from the user to store into array
printf("Input Number %d:",(i+1));
scanf("%d",&a[i]);//inputing into array
if(a[i]%10==0){//using if loop to see whether it is divided by 10 or not
sum=sum+a[i];//if divided add the tha element entered to sum which is intialised initally as zero
}
}
printf("The sum of multiples of 10 is:%d ",sum);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote