Practice Program







  • Check divisibility of a number?
  • void main()
    {
        int n,d;
    
    
        printf("Enter the number: ");
        scanf("%d",&n);
    
        printf("\nEnter the number with whom  divisibility you want check: ");
        scanf("%d",&d);
    
        if(n%d==0)
        {
            printf("\n%d is divisible by %d",n,d);
        }
        else{
            printf("\n%d is not divisible by %d",n,d);
        }
    }
    

    Output1
    Enter the number:12

    Enter the number with whom divisibility you want check:3

    12 is divisible by 3.
    Output2
    Enter the number:17

    Enter the number with whom divisibility you want check:4

    17 is not divisible by 4.
    Output3
    Enter the number:25

    Enter the number with whom divisibility you want check:5

    25 is divisible by 5.