Last active
September 10, 2015 10:24
-
-
Save Mati365/eae8d5263ed41b789aa6 to your computer and use it in GitHub Desktop.
This file contains 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 <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
void silnia() { | |
int n = 0, t = 1, i =0; | |
printf("Dawaj silnie:"); scanf("%d", &n); | |
if(n >= 0) { | |
for(i = 1;i <= n; ++i) | |
t *= i; | |
printf("%d", t); | |
} | |
} | |
void fib() { | |
int n = 0; | |
printf("Dawaj zakres fib:"); scanf("%d", &n); | |
int t1 = 0, t2 = 1; | |
for(; n >= 0; --n) | |
printf("%d ", t2 = (t1 = t1 + t2) - t2); | |
} | |
void nww() { | |
int t[2], t2[2]; | |
printf("Daj mi te dwie liczby:\n"); scanf("%d %d", &t[0], &t[1]); memcpy(t2, t, 8); | |
if(t[0] < 0 || t[1] < 0) return; | |
while(t2[1]) { | |
int t = 0; | |
t2[1] = t2[0] % (t = t2[1]); | |
t2[0] = t; | |
} | |
printf("%d", (t[0]*t[1]/t2[0])); | |
} | |
void shit() { | |
int t[3]; scanf("%d %d %d", &t[0], &t[1], &t[2]); | |
if(t[0]) { | |
float d = t[1]*t[1]-4*t[0]*t[2]; | |
if(!d) printf("%f", -t[1]/2*t[0]); | |
else if(d >= 0) { | |
printf("%f", d); | |
printf( "x0: %f x1: %f" | |
, (-t[1]-sqrt(d))/2*t[0] | |
, (-t[1]+sqrt(d))/2*t[0] | |
); | |
} | |
else printf("Nie działa"); | |
} | |
} | |
int main() { | |
shit(); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment