AedenCak3

Add all integer numbers in an infinite loop till 0 is entered

Nov 30th, 2021
682
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n,sum=0;
  5.     for(int i=0;i>=0;i++)
  6.     {
  7.         printf("enter number: ");
  8.         scanf("%d", &n);
  9.         if(n==0)
  10.             break;
  11.         sum+=n;
  12.     }
  13.  
  14.     printf("%d", sum);
  15. }
RAW Paste Data