Advertisement
adventuretimeh

somm interi

Feb 15th, 2020
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5. // scrivi un programma che legge un numero num e quindi succesivamente esegue la somma di num interi inseriti dall utente
  6.  
  7. int main(int argc, char *argv[]) {
  8.     int numero,somma,conta;
  9.     somma=0;
  10.     conta=0;
  11.     printf("numero");
  12.     scanf("%d",&numero);
  13.     while(numero!=0)
  14.     {
  15.        
  16.         somma=somma+numero;
  17.          printf("numero");
  18.     scanf("%d",&numero);
  19.        
  20.         conta=conta+1;
  21.     }
  22.     printf("la somma vale %d",somma);
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement