Created
February 29, 2012 14:19
-
-
Save wbzyl/1941165 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
int main() | |
{ | |
double a, b, c, i; | |
double wynik; | |
char *formatka = "| %.6f | %.6f |"; | |
//char *head = "%s|%s\n"; | |
char bufor[100]; | |
char wyliczona_formatka[100]; | |
printf("Podaj wartosc poczatkowa: "); | |
scanf("%lf", &a); | |
printf("Podaj krok postepu: "); | |
scanf("%lf", &b); | |
printf("Podaj wartosc koncowa: "); | |
scanf("%lf", &c); | |
for (i = a; i <= c; i = i + b) { | |
wynik = sqrt(i); | |
sprintf(bufor, formatka, a, wynik); | |
//printf(bufor); | |
/* printf(formatka, a, wynik); */ | |
a = a + b; | |
} | |
sprintf(wyliczona_formatka, "%20s|%16s\n", "liczba", "pierwiastek"); | |
// printf("szerokosc formatki: %d\n", strlen(formatka)); | |
printf("--------------------\n"); | |
printf(wyliczona_formatka); | |
printf("--------------------\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment