Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- #include <conio.h>
- //replaces every n occurrencies with 7
- #define n 10
- void main()
- {
- int i, total=0, y[n]={1,2,3,4,5,6,7,8,9,10};
- clrscr();
- for(i=0; i<n; i++)
- //display the array content
- {
- cout<<y[i]<<" ";
- total=total+y[i];
- }
- //display the total
- cout<<"\n sum of 10 in an array is ="<<total;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment