+ 1
excuse me. help me to how coding( use looping for )this output 10 + 8 + 6 + 4 + 2 = 30 10 + 8 + 6 + 4 = 28 10 + 8 + 6 = 24 10 + 8 = 18 10 = 10 ======= + 110
12 odpowiedzi
+ 9
# include <iostream>
using namespace std;
int main ()
{
cout <<"10+8+6+4+2=30" <<endl;
cout <<"10+8+6+4=28"<<endl;
cout <<"10+8+6=24 "<<endl;
cout <<"10+8=18"<<endl;
cout <<"10=10"<<endl;
cout <<" ======+"<< endl;
cout <<" 110"<<endl;
return0
}
+ 8
@Dinu Cuz you missed out on utilising for loops but nice try anyways lol
+ 7
@Dinu your answer literally made me lol
+ 6
@Rina Mirushita
#include <iostream>
using namespace std;
int main() {
int TSum=0;
for(int j=2 ;j<=10;j+=2){
int AccSum=0;
for(int i=10;i>=j;i-=2){
AccSum+=i;
TSum+=i;
cout<<i;
if (j!=i){
cout<<"+";
}
else{
cout<<"=";
}
}
cout<<AccSum;
cout<<endl;
}
cout<<"===========+"<<endl;
cout<<TSum;
return 0;
}
+ 4
@Dinu lol. thanks.
+ 2
what's the difference? it outputs the same thing
+ 2
I posted a code for you:
https://code.sololearn.com/cN0pqka7zir6/?ref=app
+ 2
thank you very much 😊
0
why we use using name space std; ?
0
0+100
0
its'a header file bro
0
@Taha Malik,if you don't use it,you need to put std:: before every cout,cin,endl,shortly,all the things iostream includes,it's easier to put namespace std