1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

why

Discussion in 'C' started by ptgcomputer, Mar 28, 2008.

  1. ptgcomputer

    ptgcomputer New Member

    Joined:
    Mar 15, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    hi iam praveen iam having doubt please try to solve it
    if iam having
    main()
    { int a=500,b,c;
    if(a<=400)
    b=300;
    c=200;
    }
    only the value of c is displayed but the value of b is not displayed correctely
     
  2. bashamsc

    bashamsc New Member

    Joined:
    May 22, 2007
    Messages:
    51
    Likes Received:
    7
    Trophy Points:
    0
    Location:
    chennai
    ur condition is wrong . To print b and c ur condition should be a>=400 or a>400 or a>=500.
     
  3. ptgcomputer

    ptgcomputer New Member

    Joined:
    Mar 15, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    hi iam praveen i am having doubt
    if iam having like this then what is wrong in it i am not able to find it output is not coming
    Code:
      main()
        { int  n, s ,pay;
          printf("Enter the value of n\n");
           scanf("%d",&n);
           while(n>40)
           {    s=(n-40)*12;
                pay=s*10;
                 printf("the pay  is =%d",pay);
           }
    
    )
    this is to find the pay ment of the employees of 10 to pay the money above 40 hours as 12 per extra hour how to fing mistake or what is the mistake
     
    Last edited by a moderator: Apr 2, 2008

Share This Page