Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

any one give answer to my question?

We have write one 'C' program.

Problem is

Accept floating point no from user,and find out this no is divisible by 7 and not divisible by 2.

constriants

using simple if statment only,not nested if statement.

In if statemnet using only logical or not allowed logical AND.

Update:

no need the no.

i want program in 'c' languagae

6 Answers

Relevance
  • 2 decades ago
    Favorite Answer

    include <stdio.h>

    void main(){

    float no;

    scanf("%f",&no);

    if(!( ((int)no)%7!=0 || ((int)no)%2==0 ))

    printf("No is divisible by 7 and not divisible by 2");

    }

    salam

  • 2 decades ago

    23

  • 2 decades ago

    ...no matter how bright or cloudy the

    day, when the sun goes down, it gets

    dark. That's logic as I know it.

    Floating points,statments and statemnets make

    no sense whatever.

  • 2 decades ago

    main()

    {

    float a,b;

    printf ("enter the number");

    scanf("%f",&a);

    b=(int) a;

    if (b%7==0)

    {

    if (b%2!=0)

    {

    printf ("divisible by 7 and not by 2);

    }

    else

    printf ("Not divisible by 7");

    }

    getch();

    }

  • How do you think about the answers? You can sign in to vote the answer.
  • 2 decades ago

    float n;

    int x,y;

    printf("Enter a number :");

    scanf("%f",&n);

    x=n%7;

    y=n%2;

    if(x != 0) printf("It is not divisible by 7)

    else prinft("It is divisible by 7);

    if(x != 0) printf("It is not divisible by 2)

    else prinft("It is divisible by 2);

  • 2 decades ago

    hmm.. 49?

Still have questions? Get your answers by asking now.