Search This Blog

Thursday, 9 July 2015

C++ program to check integer whether divisible by 5 or 3.

# include <stdio.h>
int main(){

int number;
printf("Check number divisibility\n");
scanf("%d", &number);

if (number%5 == 0 && number%3 == 0)
printf("\nThe number is divisible by 5 and 3\n");
else if (number%5==0)
printf("\nThe number is divisible by 5\n");
else if  (number%3==0)
    printf("\nThe number is divisible by 3\n");
else
printf("\nThe number isn't divisible by 3 or 5\n");

return 0;
}




Input- 5
Output- The number is divisible by 5

Labels- Code, c++, awesome, must, programming, divisible, by 5, by3, qcoders, qcoder, mmhasanovee, good.

No comments:

Post a Comment