Monday 4 February 2013

IT series Control Structure part 3:

To check wheter the third one is the common divisior of the first and second one.

void main()
{
int a,b,c;
cout<<"Enter three numbers\n";
cin>>a>>b>>c;

if(a==0)
cout<<"Sorry try again\n";
else
{
if(b%a==0 && c%a==0)
cout<<"The first number is divisble of the second and third one\n";
else
cout<<"First variable is not divisor of the second and third one\n";
}
}

No comments:

Post a Comment

Comments please: