TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abdalla Omran
NA
334
31.8k
How to read a Temperature for August and get the total Aveg
May 8 2019 3:49 AM
Hi there
How to read a Temperature for August and get the total Aveg just for 29 day instead 31 day ?
i want to get the Aveg Temperature of August which has 31 day but sometime there is a data of temp just for 29 or 27 however how could i get the Avag based on how many days has been read and saved as data that could be (29,27,26 or 10 days) ?
here is the code :
public
static
TheWeather GetAverageForMonth(List<TheWeather> entries,
int
year,
int
month)
{
if
(entries ==
null
|| entries.Count < 1)
return
null
;
int
days = 0;
int
index = entries.Count();
double
total = 0.0;
double
Aveg = 0.0;
for
(index = 0; index < entries.Count; index++)
{
if
(entries[index].dateTime.Year == year && entries[index].dateTime.Month == month)
{
total += entries[index].Actual_mean_temp;
days = entries[index].dateTime.Day;
}
}
Aveg = total / days;
return
entries[index];
Reply
Answers (
3
)
How to validate PAN Card number using c#?
Getting null when reading extended tags on a TIF file.