Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int d,m,r,a;
- printf("Podaj date (w formacie dd-mm-yyyy)\n");
- a=scanf("%d-%d-%d",&d,&m,&r );
- if(a!=3)
- {
- printf("Incorrect input");
- return 1;
- }
- else if((d>0) && (d<=31) && (r>0) &&( (m==1) || (m==3) || (m==5) || (m==7) || (m==8) || (m==10) || (m==12) ))
- {
- printf("Correct");
- }
- else if((d>0) && (d<=30) && (r>0) &&( (m==4) || (m==6) || (m==9) || (m==11) ) )
- {
- printf("Correct");
- }
- else if((d>0) && (d<=28) && (r>0) && (m==2))
- {
- printf("Correct");
- }
- else if((d>0) && (d<=29) &&((r%400==0)||(r%4==0 &&r%100!=0)) && (m==2))
- {
- printf("Correct");
- }
- else
- {
- printf("Incorrect");
- }
- return 0;
- }
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int d,a;
- float c;
- printf("podaj prad\n");
- a=scanf("%d",&d);
- if(a!=1)
- {
- printf("Incorrect input");
- return 1;
- }
- else if(d<=50)
- {
- c=d*0.5*0.22;
- printf("koszt to %f",c);
- }
- else if(d<=150)
- {
- c=d*0.75*0.22;
- printf("koszt to %f",c);
- }
- else if(d<=250)
- {
- c=d*1.2*0.22;
- printf("koszt to %f",c);
- }
- else if(d>250)
- {
- c=d*1.5*0.22;
- printf("koszt to %f",c);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement