Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <locale.h>
- inline void gwiazdki() {
- int i;
- for (i = 1; i <= 120; i++)
- {
- printf("*");
- }
- }
- void autor() {
- printf("Autor programu: Teresa Chrzan \n\n");
- }
- float wynikdz(float a, float b) {
- float iloraz;
- iloraz = a / b;
- return iloraz;
- }
- int main()
- {
- setlocale(LC_CTYPE, "Polish");
- float a, b, wynik, tab[51];
- int res = 1, ilepow = 0;
- gwiazdki();
- autor();
- gwiazdki();
- do {
- if (ilepow > 51) {
- printf("Niemożliwa dalsza iteracja z uwagi na ograniczony rozmiar tablicy!");
- break;
- }
- printf("\n");
- printf("Dzielenie liczb \n");
- printf("podaj dzielną: ");
- scanf_s("%f", &a);
- printf("podaj dzielnik: ");
- scanf_s("%f", &b);
- if (b != 0)
- {
- if (ilepow < 51) {
- wynik = wynikdz(a, b);
- printf("ILORAZ wynosi: ");
- printf("%f", wynik);
- tab[ilepow] = wynik;
- }
- }
- else {
- printf("\n");
- printf("BŁĄD DZIELENIA PZRZEZ ZERO !!!");
- system("pause");
- return 0;
- }
- printf("\n Czy wykonać cały program ponownie (t/n)? ");
- scanf_s(" %c", &res, 1);
- ilepow++;
- } while (res == 't');
- if (res == 'n')
- {
- if (ilepow < 51)
- {
- printf("\n");
- printf("Wszystkie wyniki dzielenia - kolejno: ");
- for (int i = 0; i < ilepow; i++) {
- printf(" %f ", tab[i]);
- }
- }
- }
- else
- {
- printf("\n Musisz wpisać \'t\' albo \'n\', program zostanie zatrzymany! \n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement