How to calculate diameter, circumference and area of a circle by using radius

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmeddin
    New Member
    • Oct 2007
    • 3

    How to calculate diameter, circumference and area of a circle by using radius

    How to calculate diameter, circumference and area of a circle by using radius---

    Hello!
    I have been trying to learn C language.I bought a book "C How to Program,Deitel& Deitel"...I make practise by myself,but sometime it get harder for me...i searched good examples on the internet.i have two example of four,which i couldnt do.these are;
    1) Write a program that declares 2 floating point numbers and initializes them to 1.5 and 5.5 respectively. Find the multiplication and sum of both those numbers and print the results on screen.
    2)Write a program that enters the radius of a circle and prints the circle’s diameter, circumference and area. Perform each of these calculations inside the printf statements.

    Somebody help me?I think,i did everything what i must to do..but is doesnt work =(
  • Meetee
    Recognized Expert Contributor
    • Dec 2006
    • 928

    #2
    Originally posted by ahmeddin
    How to calculate diameter, circumference and area of a circle by using radius---

    Hello!
    I have been trying to learn C language.I bought a book "C How to Program,Deitel& Deitel"...I make practise by myself,but sometime it get harder for me...i searched good examples on the internet.i have two example of four,which i couldnt do.these are;
    1) Write a program that declares 2 floating point numbers and initializes them to 1.5 and 5.5 respectively. Find the multiplication and sum of both those numbers and print the results on screen.
    2)Write a program that enters the radius of a circle and prints the circle’s diameter, circumference and area. Perform each of these calculations inside the printf statements.

    Somebody help me?I think,i did everything what i must to do..but is doesnt work =(
    Hi,

    What difficulties you are encountering? Please post your efforts here. There are some formulas of circle. You just need to apply them in C. everything is given here so describe your exact problem.

    Regards

    PS Read posting guidelines

    Comment

    • ahmeddin
      New Member
      • Oct 2007
      • 3

      #3
      I have nothing about the first question...but i made something for the second one..

      "
      [CODE=c]#include <stdio.h>

      int main()

      {
      int pi,radius,diame ter,circumferen ce,area;

      printf("Enter the radius of the circle\n");
      scanf("%d",&rad ius);

      pi=3,14;
      diameter=radius *2;
      circumference=2 *pi*radius;
      area=pi*radius* radius;

      scanf("%d%d%d", &diameter,&circ umference,&area );

      return 0;
      }[/CODE]

      "
      Last edited by Ganon11; Oct 11 '07, 01:49 PM. Reason: Please use the [CODE] tags provided.

      Comment

      • kreagan
        New Member
        • Aug 2007
        • 153

        #4
        Originally posted by ahmeddin
        I have nothing about the first question...but i made something for the second one..

        "
        Do you not understand the question? (Quite honestly, I think the second question was trickier than the first.) Why is the first question giving you problems?

        Comment

        • sksriharsha
          New Member
          • Oct 2007
          • 31

          #5
          The first one is too easy.
          The second one maybe something like this

          [ spoonfeeding code removed ]

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by ahmeddin
            int pi
            There is some biblical 'evidence' (mind the quotes) that this should be true but
            the entire mathematical world thinks otherwise.

            kind regards,

            Jos

            Comment

            • sksriharsha
              New Member
              • Oct 2007
              • 31

              #7
              Sorry for that, I am new and I just read the guidelines. This will not be repeated.

              Comment

              • ahmeddin
                New Member
                • Oct 2007
                • 3

                #8
                Originally posted by kreagan
                Do you not understand the question? (Quite honestly, I think the second question was trickier than the first.) Why is the first question giving you problems?
                is this important which one is easier?these are my efforts.i tried to do something.but i cant...

                Comment

                • Banfa
                  Recognized Expert Expert
                  • Feb 2006
                  • 9067

                  #9
                  Originally posted by ahmeddin
                  is this important which one is easier?these are my efforts.i tried to do something.but i cant...
                  Actually it is important, because what you learn by doing question 1 you will use in solving question 2, which is probably why they were set in that order.

                  Comment

                  • kreagan
                    New Member
                    • Aug 2007
                    • 153

                    #10
                    Originally posted by ahmeddin
                    is this important which one is easier?these are my efforts.i tried to do something.but i cant...
                    The comment wasn't ment to undermind your efforts at all. I'm just confused why you are stuck since you did the second one with no help from this forum.

                    Maybe this might help you. The first problems uses the exact same principles as the second except changes what you are looking for. Instead of finding the area, you are creating a number that is the addition of the two given variables and a multiplication of the two.

                    Comment

                    Working...