Write a c++ program to generate odd numbers from 100 to 200
Answers
Answer://**************************************
// Name: Print Odd Numbers From 1 To 100 in C++
// Description:This simple program will display odd numbers from 1 to 100 the code is very simple and easy to understand using C++.
Add me at Facebook my address is [email protected] and [email protected].
My mobile number here in the Philippines is 09173084360.
// By: Jake R. Pomperada
//**************************************
odd.cpp
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
cout << "Print Odd Numbers from 1 to 100";
cout << "\n\n";
for (int a=1; a<=100; a+=2) {
cout << " " << a << " ";
}
cout << "\n\n";
cout << "End of Program";
cout << "\n\n";
system("pause");
}
Explanation:
Answer:
Write a program in C++ to display the odd numbers from 101 to 200.
Ans: #include <iostream.h>
int main()
{
for(int num=101; num<=200; num++)
{
if(num%2!=0) cout<<num<<", ";
}
return 0;
}