Pages

Monday, January 2, 2012

C Programming to decide if a number is divisible by 2 but not by 3


/*to decide a number divisible by 2 but not by 3*/
#include<stdio.h>
#include<stdlib.h>
int main( )
{
    int n;
    printf ("enter number: ");
    scanf ("%d",&n);
    if (n%3==0&&n%2!=0)
       printf ("%d is divisible by 3 but not by 2",n);
    else
        printf ("condition doesnot meet");
    system ("pause");
    return 0;
}

No comments:

Post a Comment