Monday 22 April 2013

A programme to check the divisibility of a number by 3

Description:

In C++ if there is conditional logic then "if", "else" statements are used.

Code:


#include<iostream>
#include<conio.h>
#include<iomanip>
using namespace std;
int main()
{
    int a,b,c;
    cout<<"A programe to check the divisibility of a number by 3"<<endl;
    xy:
    cout<<"Enter the number to check its divisibility"<<endl;
    cin>>a;
    cout<<endl;
    if(a%3==0)
    {
              cout<<"The number is divisible by 3"<<endl;
           
              }
           
              goto xy;
              getche();
              return 0;
              }


Output:


No comments:

Post a Comment