online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ /****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include<stdio.h> int main(void) { int i, NUMS; int day = { 1-10 }; int totalHigh = 0; int totalLow = 0; int high[10]; int low[10]; double average; printf("---=== IPC Temperature Caculator V2.0 ===---\n"); printf("\n"); printf("Please enter the number of days, between 3 and 10, inclusive: "); scanf("%d", &NUMS); printf("\n"); while (NUMS < 3 || NUMS > 10) { printf("Invalid entry, please enter a number between 3 and 10, inclusive: "); scanf("%d", &NUMS); printf("\n"); } for (i = 0; i < NUMS; i++) { printf("Day %d - High: ", i + 1); scanf("%d", &high[i]); printf("Day %d - Low: ", i + 1); scanf("%d", &low[i]); while (high[i] > 40 || high[i] < -40 || low[i] > 40 || low[i] < -40 || high[i] < low[i]) { printf("Incorrect values, temperatures must be in the range -40 to 40, high must be greater than low.\n"); printf("\n"); printf("Day %d - High: ", i + 1); scanf("%d", &high[i]); printf("Day %d - Low: ", i + 1); scanf("%d", &low[i]); } } printf("\n"); printf("Day Hi Low\n"); printf("\n"); for (i = 0; i < NUMS; i++) { printf("%d %d %d\n", i + 1, high[i], low[i]); } int max = 0; int min = 0; for (i = 0; i < NUMS; i++) { if (high[max] < high[i]) max = i; if (low[min] > low[i]) min = i; } printf("\nHighest temperature was: %d on day %d", high[max], max+1); printf("\nLowest temperature was: %d on day %d ", low[min], min+1); printf("\n"); printf("Enter a number between 1 and %d to see the average temperature for the entered number of days, enter a negative number to exit: ", NUMS); scanf("%d", &day); while (day == 0 || day > NUMS) { printf("\n"); printf("Invalid entry, please enter a number between 1 and %d, inclusive: ", NUMS); scanf("%d", &day); } while (day <= NUMS && day > 0) { for (i = 0; i < day; i++) { totalHigh += high[i]; totalLow += low[i]; average = (double)(totalHigh + totalLow) / (day * 2); } printf("\n"); printf("The average temperature up to day %d is: %.2lf\n", day, average); printf("\n"); printf("Enter a number between 1 and %d to see the average temperature for the entered number of days, enter a negative number to exit: ", NUMS); scanf("%d", &day); totalHigh = 0; totalLow = 0; average = 0; } printf("\nGoodbye!\n"); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue