C program for Sum of N numbers using Array technique. This simple C source code is coming under the part of C beginners guide. This sample code can be used for an Engineering, Diploma and all kind of Degree students and professionals.
Sum of 10 numbers using Array
Sum of N numbers using Array in C program is used to calculate the value of array 10 numbers and it will display a sum value by using a looping statement (for loop). Basic formula is (sum=sum+a[i]).
[Read: Education Loan Guide] & [Study Abroad Details]
WRITE A C PROGRAM:
/* Title: Sum of N numbers using Array Author: Vinoth Selvaraj © http://students3k.com */ //Header files # include <stdio.h> # include <conio.h> void main() { //Program variable int b[10],s,j,su=0; clrscr(); //Function is used to clear previous output for (j=1;j<=10;j++) //Looping statement { printf("ENTER THE NUMBER::---"); //Display function scanf("%d",&b[j]);//Getting input function } for(j=1;j<=10;j++) b[j]=b[j]*b[j]; for(j=1;j<=10;j++) printf("\nthe numbers are %d",b[j]); for(j=1;j<=10;j++) su=su+b[j]; printf("\n THE SUM OF 10 NUMBERS ARE %d",su); getch(); }