icebowl

tableabc.c

May 12th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. // cw coleman  Do not copy and pase this code.  Type it. I did!
  2. //compile  gcc tableabc.c -o tableabc -lm
  3. // run ./tableabc
  4. #include <stdio.h>
  5. #include <math.h>
  6. float table (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.     printf("\n\t ************* ************* ************* ************* *************\n");
  19.     table (a,b,c);
  20.         return 0;
  21. }
  22.  
  23.  
  24. float table (float a, float b, float c){
  25.    
  26.         int x;
  27.         float y;
  28.         printf("\t x \t | \t y \n");
  29.    
  30.         for (x = -20; x < 21; x++){
  31.             y = a*(x*x) + (b*x) +c;
  32.             printf("\t %d \t | \t %f\n", x,y);
  33.            
  34.         }
  35.         return 0;
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment