Write an algorithm that determines the day number ( 1 to 366) in a year for a date that is provided as input data. For example, 1/1/1994 is the day number 1, while, 31/12/1994 is the day number 366 because 1994 is a leap year.
Hint: A year is a leap year if it is devisable by 4 except any year that is divisible by 100 is a leap year if it is divisible by 400.
( sorry i want it in flowchart and pseudo-code)
1
Expert's answer
2012-10-26T10:38:16-0400
#include<iostream> using namespace std;
char msg[200], inv[200]; int y, m, d, n=0, i;
void main(){ cout<<"enter the year: "; cin>>y; cout<<"enter the month: "; cin>>m; cout<<"enter the day: "; cin>>d; n += d; for (i=1; i<m; i++){ & if (i==1) n+=31; & if ((y%4==0)&&(i==2)) n+=29; & else if (i==2) n+=28; & if (i==3) n+=31; & if (i==4) n+=30; & if (i==5) n+=31; & if (i==6) n+=30; & if (i==7) n+=31; & if (i==8) n+=31; & if (i==9) n+=30; & if (i==10) n+=31; & if (i==11) n+=30; } cout<<"the day number is "<<n<<".\n"; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment