Thread: Need help in C

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by drinu1232 View Post
    Hi all,
    I am new in programming with C. Will you please help me to solve the following problem:

    I want a program whose function is to enter the volume of a sphere 'x' and the program has to find out the unknown radius of the sphere and when the program finds radius, the program has to tell you if the sphere can go through the pipe of not.
    From your posted source code...

    You need to look up the caret ( ^ ) operator I don't think it does what you think it does.

    Move the calculation of b above your first printf() and have printf print b instead of doing the math twice. It will also give you confirmation that b is calculated correctly.

    There's no need for multiple ifelse structure. The sphere either fits or it doesn't...
    Code:
    if (b < 5)
      printf("it fits");
    else
      printf(it don't fit");
    Also please use code tags when posting your code to the forum.
    Last edited by CommonTater; 10-30-2010 at 07:00 AM.

  2. #2
    Registered User
    Join Date
    Oct 2010
    Posts
    5
    Quote Originally Posted by CommonTater View Post
    From your posted source code...

    You need to look up the caret ( ^ ) operator I don't think it does what you think it does

    so what can i use instead of ^ ??

    Can someone please fix the error for me since i can hardly understand a thing from what you are saying :O (im still a beginner)

    thx in advance

Popular pages Recent additions subscribe to a feed