Advertisement
Alessio08ztk

Esercizio_2.c

Oct 20th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main (void){
  4.     int x,y,max,min;
  5.     float z,med;
  6.     printf("Immetti un numero per x\n");
  7.     scanf("%d%",&x);
  8.     printf("Immetti un numero per y\n");
  9.     scanf("%d",&y);
  10.     printf("Immetti un numero per z\n");
  11.     scanf("%f",&z);
  12.    
  13.         if((x>y) && (x>z))
  14.         max=x;
  15.     if((y>x) && (y>z))
  16.         max=y;
  17.    
  18.     if ((z>x) && (z>y))
  19.         max=z;
  20.    
  21.     if ((x<y) && (x<z))
  22.         min=x;
  23.    
  24.     if ((y<x) && (y<z))
  25.         min=y;
  26.    
  27.     if ((z<y) && (z<x))
  28.         min=z;
  29.    
  30.    
  31.     med=x+y+z/3;
  32.     printf("Il numero massimo :%d\n",max);
  33.     printf("Il numero minimo:%d\n",min);
  34.     printf("La media:%f\n",med);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement