Advertisement
adventuretimeh

max (while)

Feb 9th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #include <time.h>
  5. #include <conio.h>
  6.  
  7. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  8. //Scrivi un programma che legge 10 numeri e ne stampa il massimo//
  9.  
  10. int main(int argc, char *argv[]) {
  11.   int i, num1, max;
  12.     max=0;
  13.     i=0;
  14.     while (i<10) {
  15.         i++;
  16.         printf ("Inserisci il numero %d:", i);
  17.          scanf ("%d", &num1);
  18.         if (num1>max) max=num1;
  19.         }
  20.         printf ("Il numero massimo e' %d", max);
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement