Program to find Addition of "n" numbers useing for loop

Program :-

#include<iostream.h>
void main()
{
int total = 0;
for(int i=1;i<11;i++)  \\ 11 number i used for example
{
total  = total + i;
}
cout<<"sum of first 10 numbers is :-"<<total;  \\10 number i used to get output of
}                                                                            \\sum of 10 numbers


Output :- sum of first 10 numbers is:- 55


It is one of the great programs for example u can just change the numbers and get the output
of any number you want
Its like
1+2+3+4 =10
This is for sum of 4 numbers. 

Comments

Popular posts from this blog

How to make a snake game using notepad using html [ with pictures ]

how to speed up your internet using cmd [command prompt] with pictures [100% working]