Radical Developers welcomes all the visitors to be a member of the team. Come join us. Its all about open-source concept. All Programs are written and tested in MacOS X, Unix, Linux and may not match with the outputs of Turbo C++ in Windows

Sunday, January 9, 2011

Write a program to calculate sum of given 10 numbers using array.


Source Code :

#include<stdio.h>
void main()
{
      int a[10],i,sum=0;
      clrscr();
      printf("\nEnter 10 Numbers : ");
      for(i=0;i<10;i++)
            scanf("%d",&a[i]);
      for(i=0;i<10;i++)
            sum+=a[i];
      printf("\nSum of 10 Numbers : %d",sum);
      getch();
}

Output :

Enter 10 Numbers : 1 5 6 9 8 7 4 6 3 2

Sum of 10 Numbers : 51

No comments:

Post a Comment