Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- //użytkownik miał wprowadzić całkowite wartości a,b,c. program miał policzyć a^b/c!
- int silnia (int n)
- {
- if (n == 0) return 1;
- else return n*silnia(n-1);
- }
- float potegowanie(float podstawa, int wykladnik)
- {
- float wynik=1;
- int i;
- for(i=0; i<wykladnik; i++)
- {
- wynik=wynik*podstawa;
- }
- return wynik;
- }
- int main()
- {
- int a, b, c;
- float wynik;
- printf("Podaj a: ");
- scanf("%d", &a);
- printf("Podaj b: ");
- scanf("%d", &b);
- printf("Podaj c: ");
- scanf("%d", &c);
- wynik = potegowanie(a, b)/silnia(c);
- printf("Wynik: %.3f", wynik);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement