0
You are given a program that outputs all the numbers from 0 to 20. Change the code to make it output only numbers that are mult
You are given a program that outputs all the numbers from 0 to 20. Change the code to make it output only numbers that are multiples of 3. I want it's solution in C++.
12 ответов
+ 4
Try this:
for(int num=0;num<=20;num++)
{
if(num%3==0)
{
cout<<num<<endl;
};
};
+ 3
if (number%3==0):
cout<<number
just to tell you it's a hint(more of an actual solution) ,do not use Q&A for asking codes tho ,post what you have tried and format your question properly to ask if you have a certain doubt related about what you can't really understand
+ 2
int num=0
While (num<20){
Cout << num;
num=(num+1)*3;
}
This is my attempt
But its out are 3 and 12
But the expected outs are 3,6,12
+ 2
try this
#include <iostream>
using namespace std;
int main()
{
//change the code
int num = 0;
while(num<=20 ){
cout<<num<<endl;
num+=3;
if(num==0){
continue;
}
}
return 0;
}
+ 2
Try This! CHEERS!!
#include <iostream>
using namespace std;
int main()
{
int num;
for(num=0;num<=20;num++)
{
if(num%3==0 && num!=0 )
{
cout<<num<<endl;
}
}
return 0;
}
0
try this ,its easy
while(number<=20 )
{
if(num%3==0 && number!=0)
cout<<number<<endl;
number+=3
}
0
int num = 0;
if(num +=3 ){
while ( num <= 20){
cout<<num<<endl;
num+=3;}
}
return 0;
}
0
#include <iostream>
using namespace std;
int main()
{
int num = 3;
while(num<=20){
cout<<num<<endl;
num+=3;
}
return 0;
}
0
#include <iostream>
using namespace std;
int main()
{
//change the code
int num = 3;
while(num<=20){
cout<<num<<endl;
num+=3;
}
return 0;
}
0
#include <iostream>
using namespace std;
int main()
{
//change the code
int num = 0;
while(num<=20){
if(num==0){
cout<<endl;
}
else{
cout<<num<<endl;
}
num=num+3;
}
return 0;
}
Good Luck
0
The provided code stores the value 7 in a variable, and outputs it.
T