Advertisement
Guest User

plan

a guest
Mar 26th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. /* program1.c
  2. * Copyright 2017 Tomasz Gromelski <tomgro@sl223-05>
  3. */
  4.  
  5.  
  6. #include <stdio.h>
  7.  
  8. int main (void)
  9. {
  10. int liczba_godzin;
  11. char przedmiot[16];
  12.  
  13. printf ( "Podaj nazwe przedmiotu:\n");
  14. scanf ( "%s", przedmiot);
  15.  
  16. printf ( "Podaj liczbe godzin:\n");
  17. scanf ("%d", &liczba_godzin);
  18.  
  19. printf( "Przedmiot |L. Godzin \n");
  20. printf("%s |%d\n", przedmiot, liczba_godzin);
  21.  
  22.  
  23. int liczba_godzindwa;
  24. char przedmiotdwa[16];
  25.  
  26. printf("Podaj nazwe przedmiotu i liczbe jego godzin: \n");
  27. scanf ("%s", przedmiotdwa);
  28. scanf ("%d", &liczba_godzindwa);
  29.  
  30. int liczba_godzintrzy;
  31. char przedmiot3[16];
  32.  
  33. printf("podaj nazwe przedmiotu i liczbe jego godzin \n");
  34. scanf ("%s", przedmiot3);
  35. scanf ("%d", &liczba_godzintrzy);
  36.  
  37. printf ("Nazwa przedmiotu | Liczba godzin");
  38. printf ("%s | %d \n", przedmiot, liczba_godzin);
  39. printf ("%s | %d \n", przedmiotdwa, liczba_godzindwa);
  40. printf ("%s | %d \n", przedmiot3, liczba_godzintrzy);
  41.  
  42. int suma = liczba_godzin + liczba_godzindwa + liczba_godzintrzy;
  43. float udzial1=((liczba_godzin)*100/suma);
  44. float udzial2=((liczba_godzindwa)*100/suma);
  45. float udzial3=((liczba_godzintrzy)*100/suma);
  46.  
  47.  
  48. printf ("Przedmiot |L. Godzin |Udzial\n");
  49. printf ("%s |%d | %f%%\n",przedmiot, liczba_godzin,udzial1);
  50. printf ("%s |%d | %f%%\n", przedmiotdwa, liczba_godzindwa, udzial2);
  51. printf ("%s |%d | %f%%\n", przedmiot3 , liczba_godzintrzy,udzial3);
  52. return 0;
  53.  
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement