having an issue about the output in c programming ..
Posted
by
user2985811
on Stack Overflow
See other posts from Stack Overflow
or by user2985811
Published on 2013-11-13T03:30:58Z
Indexed on
2013/11/13
3:53 UTC
Read the original article
Hit count: 83
c
|codeblocks
i'm having a problem on running the output after putting the input.. the output doesn't show after i put the variables and i don't know how to set the code .. so if you guys could help me with this, that would be grateful..
#include <stdio.h>
#include <conio.h>
int read_temps (float temps[]);
int hot_days (int numOfTemp, float temps[]);
int printf_temps (int numOfTemp, float temps[], int numOfHotDays);
int main (void) {
int index = 0;
float tempVal;
float temps[31];
int numOfTemp, numOfHotDays;
do {
printf ("Enter the temperature:");
scanf ("%f", &tempVal);
if (tempVal!=-500.0) {
temps[index] = tempVal;
index++;
}
} while (tempVal != -500.0);
return ;
{
int i;
int count = 0;
for (i = 0; i < numOfTemp; i++) {
if (temps[i] > 32.0)
count++;
}
return count;
}
{
float sum = 0.0;
int i;
printf ("\nInput Temperatures:");
printf ("\n-------------------------");
for (i = 0;i < numOfTemp; i++) {
printf ("\nDay %d : %.2fF", i+1, temps[i]);
sum = sum + temps[i];
}
printf ("\nNumber of Hot Days : %d", numOfHotDays);
printf ("\nAverage Temperature: %.2f", sum/numOfTemp);
}
{
clrscr ();
numOfTemp = read_temps (temps);
numOfHotDays = hot_days (numOfTemp, temps);
clrscr ();
printf_temps (numOfTemp, temps, numOfHotDays);
getch ();
}
}
© Stack Overflow or respective owner