Advertisement
Guest User

Lab 1

a guest
Oct 7th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. TEMA 1
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. int main(){
  7. float a, b;
  8. printf("Scrie-ti temperatura in grade Celsius\n");
  9. scanf("%f", &a);
  10. b=32+9*(a/5);
  11. printf("Teperatura in Farenheit este %f \n", b);
  12. system("pause");
  13. return 0;
  14. }
  15.  
  16.  
  17.  
  18.  
  19. TEMA 2
  20.  
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23.  
  24. int main(){
  25. int a, l, z, o;
  26. printf("Scrie-ti numarul de ani\n");
  27. scanf("%d", a);
  28.  
  29. l=a*12;
  30. z=a*365;
  31. o=z*24;
  32.  
  33. printf("Presupunand ca un are 365 de zile, numarul de ani introdus contine %d luni, %d zile si %d ore \n", l, z, o);
  34.  
  35. system("pause");
  36. return 0;
  37. }
  38.  
  39.  
  40. JUST FOR FUN
  41.  
  42. #include <stdio.h>
  43. #include <stdlib.h>
  44.  
  45. int main(){
  46. int a, b;
  47.  
  48. printf("a=");
  49. scanf("%d", &a);
  50. printf("b=");
  51. scanf("%d", &b);
  52.  
  53.  
  54. a=b-a;
  55. b=b-a;
  56. a=b+a;
  57.  
  58. printf("a=%d si b=%d\n", a, b);
  59. system("pause");
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement