C Programming

C program with if..else statement

C program with if..else statement 1

C program to check whether a number is divisible by Aor B or both. If it is divisible by A, print “Aim”, if it is divisible by B, print “High” and if by both print” Aim Both”.

void main()
    int num, a,b;
    printf("Enter the value for num:");
    scanf("%d", &num);
    printf("Enter the value for a:");
    scanf("%d", &a);
    printf("Enter the value for b:");
    scanf("%d", &b);
    else if((num%b==0)&&(num%a!=0))
    else if((num%a==0)&&(num%b==0))
        printf("AIM BOTH");


Enter the value for num:8
Enter the value for a:4
Enter the value for b:3

Get more stuff
in your inbox

Subscribe to our newsletter and get interesting stuff and updates to your email inbox.

Bibith K Mathew (born on 29 July 1998) is an Indian Internet entrepreneur. He is best known as the CEO and Managing Director of TalkBate Digital Partners.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.