Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
glkink
/
C-programming
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a711c2bf
authored
Jan 23, 2022
by
glkink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
75098bec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
päevadeteisendus
päevadeteisendus
0 → 100644
View file @
a711c2bf
#include <stdio.h>
#include <stdio.h>
int paevadeArvKuus( int kuu, int aasta){
if( kuu==4 || kuu==6 || kuu==9 || kuu==11 ){
return 30;
}else if( kuu== 2 ){
if( aasta%4==0 && ( aasta%100!=0 || aasta%400==0) )
return 29;
else
return 28;
}else{
return 31;
}
}
int main(){
int aasta = 1900;
int kuu = 1;
int paev = 1;
int suurimPaev = 0;
int paeviMidaLisada = 0;
printf("Sisesta paevade arv: \n");
while( scanf( "%d", &paeviMidaLisada)!= 1 || paeviMidaLisada<=0 ){
printf("Sisesta ikka positiivne arv!\n");
}
paev += paeviMidaLisada;
suurimPaev = paevadeArvKuus( kuu, aasta);
while( paev>suurimPaev ){
paev -= suurimPaev;
kuu += 1;
if(kuu==13){
kuu = 1;
aasta += 1;
}
suurimPaev = paevadeArvKuus( kuu, aasta);
}
printf("Kuupaev : %d/%d/%d\n", paev, kuu, aasta);
return(0);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment