Advertisement
janducev

Untitled

Oct 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main () {
  5.  
  6. int tmp;
  7. int sumatotal=0;
  8. /*
  9. do{
  10. printf("Dame 1 numero\n");
  11. scanf("%d",&tmp);
  12. getchar();
  13. if(tmp>=0){
  14. sumatotal+=tmp;
  15. }
  16.  
  17. }while(tmp>=0);
  18. */
  19. printf("Dame 1 numero\n");
  20. scanf("%d",&tmp);
  21. getchar();
  22. while(tmp>=0){
  23. sumatotal+=tmp;
  24. printf("Dame 1 numero\n");
  25. scanf("%d",&tmp);
  26. getchar();
  27. }
  28.  
  29. printf("Sumatotal = %d\n",sumatotal);
  30.  
  31. getchar();
  32. return(0);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement