Program to print all the even numbers till "n".
ap3c
#include<iostream>
using namespace std;
//Program to print all the even numbers till "n".
int main(){
int n;
cout<<"Enter a number: ";
cin>>n;
cout<<"All the even numbers till "<<n<<" are:"<<endl;
for(int i=1; i<=n; i++){
if(i%2!=0){
continue;
}
cout<<i<<endl;
}
return 0;
}
Comments
Post a Comment