+ 2
Write a c++ program that display all the even numbers from 1_ 100 using f0r loop
Loop
7 Réponses
+ 3
read and play around with the codes in here you can code yourself in minutes. If still having difficulty insert link of your effort here we will be glad to help.
happy coding :
https://www.sololearn.com/learn/CPlusPlus/1616
+ 3
#include <iostream>
using namespace std;
int main()
{
int x;
for (x=0; x<=98; x+2)
{ x=x+2;
cout<< x <<endl;
}
return 0;
}
+ 2
Tnx alot
+ 1
Tnx
+ 1
Try this again!
#include <iostream>
#include <stdint.h>
void print_even(uint32_t max_num) {
for (uint32_t i = 2; i <= max_num; i += 2)
std::cout << i << std:: endl;
}
int main() {
print_even(2000);
return 0;
}
+ 1
Hay Edison , your code is good for upto 200 but it doesn't work for huge numbers, once check it out.
+ 1
#include <iostream>
using namespace std;
int main()
{
int x;
for (x=0; x<=98; x+2)
{ x=x+2;
cout<< x <<endl;
}
return 0;
}