rabbinur

data input in array and of it summation

Sep 9th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<conio.h>
  3.  void main()
  4.  {
  5.   int i, n, sum=0, a[100];
  6.   clrscr();
  7.   cout<<"Enter number of element of array;"<<endl;
  8.   cin>>n;
  9.   for(i=0; i<n; i++)
  10.    {
  11.     cout<<"a["<<i+1<<"]=";
  12.     cin>>a[i];
  13.     sum=sum+a[i];
  14.    }
  15.     cout<<"sum of the inputted number="<<sum<<endl;
  16.     getch();
  17.  }
Advertisement
Add Comment
Please, Sign In to add comment