This program find out whether a entered number is divisible by 3 and 5 or not.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include "conio.h" #include "stdio.h" void main() { int num; printf("\nEnter a number "); scanf("%d",&num); if(num%3==0) { if(num%5==0) { printf("\nThe number %d is divisible by 3 and 5"); } else { printf("\nThe number %d is divisible by 3 but not by 5"); } } else { printf("\nThe number %d is niether divisible by 3 nor by 5"); } getch(); } |
Output:
Enter a number 21 Number is divisible by 3 but not by 5 |
sir how can I make a program of that series:
1-2+3-4+5-6…..n terms