C++ Program that Display Series of number from 0 to Limit enter by a user and if a number is divisible by 2 then the program print I'm divisible by else I'm not divisible by 2 - 6 Players blogs for technology

give us your feedback

People Online

Breaking

ads

Post Top Ad

Thursday, October 24, 2019

C++ Program that Display Series of number from 0 to Limit enter by a user and if a number is divisible by 2 then the program print I'm divisible by else I'm not divisible by 2



C++ Program that Display Series of number from 0 to Limit enter by a user and if a number is divisible by 2 then the program print I'm divisible by else I'm not divisible by 2





#include <iostream>

using namespace std;

int main()
{
    int a=0,limit;
    cout<<"Enter the limit : " ;
   cin>>limit;
while(a<=limit){
if(a%2==0){
    cout<<a<<" I'm divisible by 2  "<<endl;

}else
if(a%2!=0){
    cout<<a<< " I'm  not divisible by 2 "<<endl;
}
a++;
}

    return 0;
}




No comments:

Post a Comment

ads1

Post Top Ad