Write a program to display sum of first 20 odd numbers using for loop in c++
please answer fast!!
Answers
Answered by
1
*answer*
Method 1 :
#include <iostream>
using namespace std;
int main() {
int a=2,s; //we know 2 is the smallest even number.
while(a<=30) { s+=a; a+=2; }
cout<<s;
return 0;
}
Explanation:
Hope it helped plaease mark me brainliest
Similar questions
Math,
1 month ago
Biology,
1 month ago
Math,
1 month ago
Hindi,
3 months ago
English,
10 months ago
Social Sciences,
10 months ago
Computer Science,
10 months ago