Last active
December 16, 2015 07:17
-
-
Save ftp27/3355dbe006a2c1bb96cf to your computer and use it in GitHub Desktop.
Yanich Tasks
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 <math.h> | |
int main() | |
{ | |
float x; | |
printf("Please, enter X: "); | |
scanf("%f", &x); | |
float y = pow((sin(x)+(7/3)),2/3); | |
printf("f(%4.2f) = %4.2f\n",x,y); | |
return 0; | |
} |
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 <math.h> | |
float mediana(int a, int b, int c) { | |
return sqrt(2*pow(a, 2)+2*pow(b, 2)+pow(c, 2))/2; | |
} | |
int main() | |
{ | |
int a, b, c; | |
printf("Please, enter A, B and C with spaces: "); | |
scanf("%d %d %d", &a, &b, &c); | |
printf("A = %d; B = %d; C = %d\n",a,b,c); | |
printf("Midiana to side A equals %4.2f\n",mediana(b,c,a)); | |
printf("Midiana to side B equals %4.2f\n",mediana(a,c,b)); | |
printf("Midiana to side C equals %4.2f\n",mediana(a,b,c)); | |
return 0; | |
} |
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 <math.h> | |
int smallest(int a, int b, int c) { | |
/* | |
a is small than b and c | |
*/ | |
if ((a <= b) && (a <= c)) { | |
return 1; | |
} | |
return 0; | |
} | |
int middllest(int a, int b, int c) { | |
/* | |
b <= a <= c or c <= a <= b | |
*/ | |
if (((a >= b) && (a <= c)) || ((a >= c) && (a <= b))) { | |
return 1; | |
} | |
return 0; | |
} | |
int biggest(int a, int b, int c) { | |
/* | |
a is biggest than b and c | |
*/ | |
if ((a >= b) && (a >= c)) { | |
return 1; | |
} | |
return 0; | |
} | |
int main() | |
{ | |
int a, b, c; | |
printf("Please, enter A, B and C with spaces: "); | |
scanf("%d %d %d", &a, &b, &c); | |
printf("A = %d; B = %d; C = %d\n",a,b,c); | |
if (smallest(a, b, c)) printf("%d",a); else | |
if (smallest(b, a, c)) printf("%d",b); else | |
if (smallest(c, b, a)) printf("%d",c); | |
printf(" <= "); | |
if (middllest(a, b, c)) printf("%d",a); else | |
if (middllest(b, a, c)) printf("%d",b); else | |
if (middllest(c, b, a)) printf("%d",c); | |
printf(" <= "); | |
if (biggest(a, b, c)) printf("%d",a); else | |
if (biggest(b, a, c)) printf("%d",b); else | |
if (biggest(c, b, a)) printf("%d",c); | |
printf("\n"); | |
return 0; | |
} |
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> | |
int main() | |
{ | |
int x; | |
printf("Please, enter X: "); | |
scanf("%d", &x); | |
if (x < 0) { | |
printf("%d\n",0); | |
} else if (x == 0) { | |
printf("%d\n",1); | |
} else { | |
printf("%d\n",(x*x+1)); | |
} | |
return 0; | |
} |
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> | |
int main() | |
{ | |
for (int a=1; a<10; a++) { | |
for (int b=1; b<10; b++) { | |
printf("%d\t",a*b); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
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> | |
int main() | |
{ | |
int a,b; | |
a = 1; | |
do { | |
b = 1; | |
do { | |
printf("%d\t",a*b); | |
b++; | |
} while (b < 10) | |
a++; | |
} while (a < 10); | |
return 0; | |
} |
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> | |
int main() | |
{ | |
int a,b; | |
a = 1; | |
while (a < 10) { | |
b = 1; | |
while (b < 10) { | |
printf("%d\t",a*b); | |
b++; | |
} | |
a++; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment