Problem 20: Divisible

Take an integer number as input from user and print “Yes” if the number is divisible by 3 and 5. And print “No” if the number is not.

2,050 total views, 2 views today

Comments

comments

4 thoughts on “Problem 20: Divisible”

  1. #include
    int main()
    {
    int n;
    scanf(“%d”,&n);
    if(n%3==0&&n%5==0)
    printf(“Yes\n”);
    else
    printf(“No\n”);
    return 0;
    }

  2. #include
    int main()
    {
    int i;
    printf(“Enter a number\n”);
    scanf(“%d”,&i);
    if(i%3==0||i%5==0)
    printf(“Yes,Divisible\n”);
    else
    printf(“No,Not Divisible\n”);
    return 0;
    }

  3. #include
    int main()
    {
    int n;
    printf(“Enter an integer number :\n”);
    scanf(“%d”,&n);
    if((n%3==0)&&(n%5==0)){
    printf(“The number is divisible by 3 and 5”);
    }
    else{
    printf(“The number is not divisible by 3 and 5”);
    }
    }

  4. #include
    int main()
    {
    int x;
    scanf(“%d”,&x);
    if(x%3==0 || x%5==0){
    printf(“yes”);
    }else{
    printf(“No”);
    }
    return 0;
    }

Leave a Reply

Your email address will not be published.