Guest User

Untitled

a guest
Jul 18th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. //Programma che calcola la seguente espressione y=ax+b
  2.  
  3. #include<stdio.h>
  4.  
  5. #define FLUSH while(getchar()!='\n')
  6.  
  7.  
  8. int main()
  9.  
  10. {
  11.    
  12.    
  13.     int x, a, b, y; //variabili intere.
  14.    
  15.    
  16.    
  17.     a = 18,    //Valore variabile a
  18.     b = 7;     //Valore variabile b
  19.    
  20.    
  21.    
  22.     printf("y=ax+b\n\n");
  23.     printf("Inserisci valore di x: ");
  24.     scanf("%d", &x);
  25.    
  26.     y = a*x + b;  
  27.    
  28.     printf("y = %d\n", y);
  29.    
  30.     getchar();
  31.    
  32.    
  33.    
  34.    
  35.     return 0;
  36.    
  37.    
  38.    
  39.    
  40.    
  41. }
Add Comment
Please, Sign In to add comment