Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- float x;
- float y;
- printf("Napisz program, ktory prosi uzytkownika o podanie liczby zmiennopozycyjnej x\n");
- printf("a nastepnie oblicza wartosc funkcji f dla tej liczby\n");
- printf("Autor programu: Marcin Wojcik\n\n");
- printf("Podaj x:\n");
- if (scanf("%f",&x)!=1 || getchar()!='\n')
- {
- printf("Bledne dane.\n");
- printf("\nKoniec programu.\n");
- return 0;
- }
- printf("Podany x = %.f\n",x);
- y=x>0?pow(2,x):-1;
- printf("Podana wartosc funkcji f = %.f\n",y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement