//Question 4
#include <iostream>
using namespace std;
int main()
{
//Question 4
//use for loop print 1 ..20
cout << "================use for loop print [1..20]=====================\n";
cout << "\t\t";
for (int i = 1; i <=20; i++)
cout << i << " ";
cout << "\n===============================================================\n";
return 0;
}
//Question 5
#include <iostream>
using namespace std;
int main()
{
//Question 4
//use for loop print even number 1 ..20 [2,4,6.....20]
cout << "================use for loop print [1..20]=====================\n";
cout << "\t\t";
for (int i = 2; i <=20; i+=2)
cout << i << " ";
cout << "\n===============================================================\n";
return 0;
}
Comments
Leave a comment