0

WAP using function to print first 10 numbers and their sum

please help me

10th Aug 2016, 3:52 PM
Chetan Dayalani
Chetan Dayalani - avatar
4 Answers
+ 2
#include <iostream> using namespace std; int main () { int sum=0; for (int i =0;i <=10;i++) sum +=i; cout <<sum; return 0; } sorry, thought you only needed the algorithm
10th Aug 2016, 4:13 PM
destro
0
Ismail where is int n ..
10th Aug 2016, 4:04 PM
Chetan Dayalani
Chetan Dayalani - avatar
0
thks destro
10th Aug 2016, 4:16 PM
Chetan Dayalani
Chetan Dayalani - avatar
- 2
#include<iostream> using namespace std; int main() { int i,n; { for(i=0;i<10;i++) { cout<<i<<endl; sum+=i; } cout<<sum; return 0: }
10th Aug 2016, 4:01 PM
ismail
ismail - avatar