Canna

Tuesday, 25 September 2018

Circle

  • Problem Description

    Write a program to calculate area of a circle

    Input and Output Format:

    Refer sample input and output for formatting specification.

    All float values are displayed correct to 2 decimal places.

    All text in bold corresponds to input and the rest corresponds to output.
  • Test Case 1

    Input (stdin)
    2
    
    
    Expected Output
    Area of Circle=12.56
  • Test Case 2

    Input (stdin)
    25
    
    
    Expected Output
    Area of Circle=1962.50
  • Program
  • #include <stdio.h>
    int main()
    {
       int a;
      float b;
      scanf("%d",&a);
      b=3.14*(a*a);
      printf("Area of Circle=%.2f",b);
     return 0;
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.