Advertisement
Guest User

Untitled

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