Last active
April 18, 2021 11:35
-
-
Save pizycki/d0039f4db0deb869ee40a9291d397097 to your computer and use it in GitHub Desktop.
Tiarkowe kolokwium
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> | |
int main() | |
{ | |
////////////////////////// | |
// Zad. 1 | |
//////////////////////////1 | |
double wiszenko; | |
printf("Wpisz wartosc dla nazwisko studenta:\n"); | |
scanf("%lf", &wiszenko); | |
if(wiszenko < 0) { | |
wiszenko = -wiszenko; | |
} | |
int ww; | |
if (wiszenko >= 0 && wiszenko <= 15){ | |
ww = 1; | |
} | |
else if (wiszenko > 15 && wiszenko < 30) { | |
ww = 2; | |
} else if (wiszenko >= 30 && wiszenko <= 45) { | |
ww = 3; | |
} else if (wiszenko > 45) { | |
ww = 4; | |
} | |
printf("ww = %d\n", ww); | |
////////////////////////// | |
// Zad. 4 | |
////////////////////////// | |
switch(ww) { | |
case 1: | |
printf("Zmienna ww - przedzial <0,15>\n"); | |
break; | |
case 2: | |
printf("Zmienna ww - przedzial (15,30)\n"); | |
break; | |
case 3: | |
printf("Zmienna ww - przedzial <30,45>\n"); | |
break; | |
case 4: | |
printf("Zmienna ww - powyzej 45\n"); | |
break; | |
default: | |
break; | |
} | |
////////////////////////// | |
// Zad. 5 | |
////////////////////////// | |
int wyn2 = ww % 2 == 0 ? 1 : -1; | |
printf("wyn2 = %d\n", wyn2); | |
return 0; | |
} |
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> | |
#define _USE_MATH_DEFINES | |
#include <math.h> | |
int main() | |
{ | |
double grzegorz = 2.15 * pow(10, -2); // a | |
double wiszenko = 34.0; // b | |
double nr110462 = -2.65; // c | |
double wyn1 = (5.0/6.0) * ( (2 * pow(grzegorz, 2.0) - 5.2) / (4*nr110462 + 2) ); | |
printf("wyn1 = %.4f\n", wyn1); | |
double wyn2 = (3 * M_PI - 4.1) / (sqrt(pow(wiszenko, 2.0) - pow(nr110462, 2))); | |
printf("wyn2 = %.4f\n", wyn2); | |
return 0; | |
} |
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> | |
int main() | |
{ | |
// x | |
double grzegorz; | |
printf("Wpisz wartosc dla imie: \n"); | |
scanf("%lf", &grzegorz); | |
// y | |
double wiszenko; | |
printf("Wpisz wartosc dla nazwisko: \n"); | |
scanf("%lf", &wiszenko); | |
int nr110462 = 0; | |
if( grzegorz >= 0 && grzegorz <= 2 | |
&& wiszenko >= 0 && wiszenko <= 2) | |
{ | |
nr110462 = 1; | |
} | |
if(grzegorz >= 3 && grzegorz <= 4 | |
&& wiszenko >= 1 && wiszenko <= 3) | |
{ | |
nr110462 = 2; | |
} | |
printf("nr110462 = %d\n", nr110462); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment