Write Program Compute Following Sum C Program Q37040922

write a program to compute the following sum? (C++program only?)

3 + 20

3 + 20 Show transcribed image text 3 + 20


Solution


#include <iostream>using namespace std;int main(){ int sum = 0; for(int i = 1;i<=20;i++){ sum += (i*i*i); } cout<<“Sum = “<<sum<<endl; return 0;}

Sum44100 Process exited after 0.8275 seconds with returnvalue 0 Press any key to continue - - -

Sum44100 Process exited after 0.8275 seconds with returnvalue 0 Press any key to continue –

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.