taking input from file
Signed-off-by: BuildTools <unconfigured@null.spigotmc.org>
This commit is contained in:
8
sum.c
8
sum.c
@@ -11,11 +11,15 @@ int main() {
|
||||
int size = 1;
|
||||
int sum = 0;
|
||||
int pos = 0;
|
||||
int end_scan = 1;
|
||||
int* arr = malloc(size * sizeof(int));
|
||||
|
||||
while(TRUE) {
|
||||
while(end_scan) {
|
||||
printf("Enter a number: ");
|
||||
scanf("%d", &(arr[pos]));
|
||||
if (scanf("%d", &(arr[pos])) == EOF) {
|
||||
end_scan = 0;
|
||||
}
|
||||
//scanf("%d", &(arr[pos]));
|
||||
if( arr[pos] == 0 ) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user