#include <iostream> using namespace std; int main() { int n1,n2; cin>>n1>>n2; if(n1 < n2) { while(n1 < n2) { n1++; cout<<n1*n2<<endl; } } else { cout<<"Error: N1 is greater than N2"; } } code example
Example: #include using namespace std; int main() { int n; cout << "Enter an integer: "; cin >> n; if ( n % 2 == 0) cout << n << " is even."; else cout << n << " is odd."; return 0; }
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter an integer: ";
cin >> n;
if ( n % 2 == 0)
cout << n << " is even.";
else
cout << n << " is odd.";
return 0;
}