Last active
April 4, 2019 19:04
-
-
Save anonur/1fed0580580fd4b2f7bc449aeedd83e4 to your computer and use it in GitHub Desktop.
Summarize integers while user enters 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int ctr = 1;//counter | |
int sum = 0;//summary | |
while(ctr != 0) { | |
printf("Enter an integer: "); | |
scanf("%d",&ctr); | |
sum += ctr;//adjust xounter to summary | |
} | |
printf("\nSummary = %d",sum); | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment