Canna

Sunday, 23 September 2018

Square root

Problem Description

Nehas task is to find a square root for a number. Guide Neha by writing a c program in finding a square root of a number.
Input:
Input should contain a valid integer number.
Output:
Should display the square root value of a number 


Input Method

Integer ranges from 1 to 999

Output Method

sum of digits of the number

  • Test Case 1

    Input (stdin)
    4
    
    
    Expected Output
    2
  • Test Case 2

    Input (stdin)
    100
    
    
    Expected Output
    10
  • Program
  • #include <stdio.h>
    #include <math.h>
    int main()
    {
    int n, s;
      scanf ("%d", & n) ;
      s=sqrt(n) ;
      printf ("%d", s) ;
     return 0;
    }

No comments:

Post a Comment

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