Tuesday 28 August 2012

Array007

Input five numbers in an array and print the square root of them.

#include <stdio.h>
#include <conio.h>
#include <math.h>

void main ( )
{
          float        n[5], n1[5], i;
          clrscr ( );
                                     
          for ( i = 0; i < 5; i++ )
          {                                     
                          printf ("\n\t\t Enter a number in an array......:"); scanf ("%f", & n[i]);
                                                              
                          n1[i] = sqrt (n[i]);
          }                                                       
                                                           
          printf ("\n\n\n\t\t\t   The Square root of Array\n");
          for ( i = 0; i < 5; i++ )
          {                                                              
                          printf ("\n\t\t\t\t %.2f\t = %.2f", n[i], n1[i]);
          }
          getch ( );
}

Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...