Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4.  
  5. int main()
  6. {
  7. int d,m,r,a;
  8.  
  9. printf("Podaj date (w formacie dd-mm-yyyy)\n");
  10.  
  11. a=scanf("%d-%d-%d",&d,&m,&r );
  12.  
  13. if(a!=3)
  14. {
  15. printf("Incorrect input");
  16. return 1;
  17. }
  18. else if((d>0) && (d<=31) && (r>0) &&( (m==1) || (m==3) || (m==5) || (m==7) || (m==8) || (m==10) || (m==12) ))
  19. {
  20. printf("Correct");
  21. }
  22. else if((d>0) && (d<=30) && (r>0) &&( (m==4) || (m==6) || (m==9) || (m==11) ) )
  23. {
  24. printf("Correct");
  25. }
  26. else if((d>0) && (d<=28) && (r>0) && (m==2))
  27. {
  28. printf("Correct");
  29. }
  30. else if((d>0) && (d<=29) &&((r%400==0)||(r%4==0 &&r%100!=0)) && (m==2))
  31. {
  32. printf("Correct");
  33. }
  34. else
  35. {
  36. printf("Incorrect");
  37. }
  38. return 0;
  39. }
  40.  
  41.  
  42.  
  43.  
  44. #include <stdio.h>
  45. #include <math.h>
  46.  
  47.  
  48. int main()
  49. {
  50. int d,a;
  51. float c;
  52. printf("podaj prad\n");
  53.  
  54. a=scanf("%d",&d);
  55.  
  56. if(a!=1)
  57. {
  58. printf("Incorrect input");
  59. return 1;
  60. }
  61. else if(d<=50)
  62. {
  63. c=d*0.5*0.22;
  64. printf("koszt to %f",c);
  65. }
  66. else if(d<=150)
  67. {
  68. c=d*0.75*0.22;
  69. printf("koszt to %f",c);
  70. }
  71. else if(d<=250)
  72. {
  73. c=d*1.2*0.22;
  74. printf("koszt to %f",c);
  75. }
  76. else if(d>250)
  77. {
  78. c=d*1.5*0.22;
  79. printf("koszt to %f",c);
  80. }
  81.  
  82.  
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement