2. Write a C program, which reads an integer and checks whether the number is divisible by both 5 and 6, or neither of them, of just one of them.

PHOTO EMBED

Sat Jul 22 2023 12:01:54 GMT+0000 (Coordinated Universal Time)

Saved by @Codes

// Online C compiler to run C program online
#include <stdio.h>

int main() {
    int n;
    printf("Enter the number: ");
    scanf("%d", &n); 
    if(n % 6 == 0 && n % 5 == 0){
        printf("%d is divisible by both", n);
        
    }
    else if(n%6==0){
        printf("%d  is only divisible by 6", n);
        
    }
    else if(n%5==0){
        printf("%d  is only divisible by 5", n);
        
    }
    else {
        printf("%d  is not divisible by both", n);
    
    }
    
   

    return 0;
}
content_copyCOPY