Advertisement
icebowl

inputhensquareroot.c

May 12th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. // cw coleman  Do not copy and pase this code.  Type it. I did!
  2. //compile  gcc inputabc.c -o inputabc -lm
  3. // run ./inputabc
  4. #include <stdio.h>
  5. #include <math.h>
  6. float squareroot (float a, float b,float c);
  7. float main(){
  8.     float a,b,c,d;
  9.     printf("\n\t ************* ************* ************* ************* *************\n");
  10.     printf("\t Type in 3 values for a,b and c. Type Enter after each input.\n");
  11.     printf("\t The square root of a+b+c will be calculated and displayed.\n");
  12.     printf("\t Input a:");
  13.     scanf("%f", &a );
  14.     printf("\t Input b:");
  15.     scanf("%f", &b );
  16.     printf("\t Input c:");
  17.     scanf("%f", &c );
  18.     d = squareroot(a,b,c);
  19.     printf("\n\t a = %f b = %f c = %f",a,b,c);
  20.     printf("\n\t The square root of a+b+c is %f ",d);
  21.         printf("\n\t ************* ************* ************* ************* *************\n");
  22.     return 0;
  23. }
  24.  
  25.  
  26. float squareroot (float a, float b, float c){
  27.         float d = sqrt(a+b+c);
  28.         return d;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement