7 days temperature from user and print their average using array
Object: Write a program that accepts temperature of 7 days from user and print their average using array. C++ projects for beginners with source code
Code:
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
float temp[7],sum=0,avg;
int i;
cout<<“Enter 7 days Tempreature:\n”;
for(i=0;i<7;i++)
{
cin>>temp[i];
sum+=temp[i];
}
avg=sum/7;
cout<<“Average of 7 days Temperature is:”<<avg;
getch();
}
#include<iostream> #include<conio.h> using namespace std; void main() { float temp[7],sum=0,avg; int i; cout<<"Enter 7 days Tempreature:\n"; for(i=0;i<7;i++) { cin>>temp[i]; sum+=temp[i]; } avg=sum/7; cout<<"Average of 7 days Temperature is:"<<avg; getch(); }
I just added this blog site to my google reader, great stuff. Can’t get enough!