Advertisement
adventuretimeh

quanti num vuoi sommare

Feb 8th, 2020
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 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.  
  6. int main(int argc, char *argv[]) {
  7.     int num,indice,somma,num1;
  8.     printf("quanti num vuoi sommare");
  9.     scanf("%d",&num);
  10.     somma=0;
  11.     indice=0;
  12.     while(indice<num)
  13.     {
  14.         printf("numero");
  15.         scanf("%d",&num1);
  16.         somma=somma+num1;
  17.         indice=indice+1;
  18.     }
  19.     printf("la somma vale %d",somma);
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement