Thread: beginner-volume of shere

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Unhappy beginner-volume of shere

    Write a program that computes the volume of a sphere with a 10meter
    radius, using the formula
    v = 4/3лr3.
    can anyone give me the answer?please

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    No.
    Post the code(in code tag) that you have problem with.

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    3
    i can't undestand the solution.....

  4. #4
    Registered User
    Join Date
    Aug 2010
    Posts
    3
    Code:
    #include <stdio.h>
    
    #define pi 3.14
    
    main()
    {
          double radius, volume;
          printf("radius=10\n");
          scanf("%f", &radius);
          volume=(4.0/3.0)*pi*(radius, 3);
          printresults();
          system("pause");
    }

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    25,640
    (radius, 3) should be pow(radius, 3). Oh, and you should #include <math.h> for the pow function... or simply write radius * radius * radius.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    And correct format specifier for double(in scanf()) is %lf not %f.
    Last edited by Bayint Naung; 08-22-2010 at 09:52 AM. Reason: ...

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    250

    Me is beginnerz too!!!!!!1111!!!111

    Write a program that converts the following sentence into english: "M3 r l4zE & r3tard3D!"

    Plees gimme anser!!
    iMalc: Your compiler doesn't accept misspellings and bad syntax, so why should we?
    justin777: I have no idea what you are talking about sorry, I use a laptop and there is no ascii eject or something

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 44
    Last Post: 03-19-2010, 04:06 PM
  2. Detect the Audio And Microphone Level In Windows
    By Kelderic in forum C Programming
    Replies: 6
    Last Post: 11-18-2009, 12:21 AM
  3. Volume of a Cone Equation always equals 0
    By Devolution in forum C Programming
    Replies: 11
    Last Post: 01-28-2009, 03:13 AM
  4. Help! Right Math, Wrong Output
    By verd in forum C Programming
    Replies: 12
    Last Post: 03-15-2005, 07:49 PM
  5. What am I doing wrong? Help please...
    By SprinterSteve in forum C Programming
    Replies: 9
    Last Post: 04-17-2003, 09:35 PM

Tags for this Thread