#include <stdio.h>
int main() {
int x;
x = 123;
int y = 321;
int age = 16;
float gpa = 1.68;
char grade = 'B';
char name[] = "Tomáš";
printf("Ahoj %s \n", name);
printf("Jsi %d roků starý \n", age);
printf("Tvoje známka je %c \n", grade);
printf("Tvůj průměr je %f \n", gpa);
return 0;
}
#include <stdio.h>
#include <stdbool.h>
int main() {
char a = 'A';
char b[] = "Tomáš";
float c = 3.141592;
float c = 3.141592653589793;
bool e = true;
char f = 100;
unsigned char g = 255;
short int h = 32767;
unsigned short int i = 65535;
int j = 2147483647;
unsigned int k = 4294967295;
long long int l = 9223372036854775807;
unsigned long long int m = 18446744073709551615;
return 0;
}
#include <stdio.h>
int main() {
return 0;
}
#include <stdio.h>
int main() {
return 0;
}
int main() {
int x = 10;
x += 2;
x -= 2;
x *= 2;
x /= 2;
x %= 2;
x %= 3;
return 0;
}
#include <stdio.h>
#include <string.h>
int main() {
char name[25];
int age;
printf("Jaké je tvoje jméno? ");
scanf("%24s", &name, 25);
fgets(name, 25, stdin);
name[strlen(name) - 1] = '\0';
printf("Hello %s, how are you? \n", name);
return 0;
}
#include <stdio.h>
#include <math.h>
int main() {
double A = sqrt(9);
double B = pow(2, 4);
int C = round(3.14);
int D = ceil(3.14);
int E = floor(3.99);
double F = fabs(-100);
double G = log(3);
double H = sin(45);
double I = cos(45);
double J = tan(45);
return 0;
}
#include <stdio.h>
int main() {
int age;
printf("Zadej věk: ");
scanf("%d", &age);
if (age >= 18) {
printf("Jsi přihlášní!");
}
else if (age == 0) {
printf("Nemůžeš s přihlásit! Zrovna ses narodil!");
}
else if (age < 0) {
printf("Ještě ses nenarodil!");
}
else {
printf("Jsi moc mladý aby ses příhlásil!");
}
return 0;
}
#include <stdio.h>
int main() {
int znamka;
printf("Vložte svoji známku: ");
scanf_s("%d", &znamka);
switch (znamka)
{
case 1:
printf("Výborně! \n");
break;
case 2:
printf("Skvěle! \n");
break;
case 3:
printf("Dobrý výsledek! \n");
break;
case 4:
printf("Aspoň to není 5! \n");
break;
case 5:
printf("Nezvládl jsi to! \n");
break;
default:
printf("Please enter only valid grades!");
break;
}
return 0;
}
#include <stdio.h>
#include <ctype.h>
int main() {
char jednotka;
float teplota;
float teplota2;
printf("Teplota je v (C), (F) nebo (K)?: ");
scanf("%c", &jednotka);
jednotka = toupper(jednotka);
if (jednotka == 'C') {
printf("Zadejte teplotu v Celsiech: ");
scanf("%f", &teplota);
teplota2 = teplota + 273.15;
teplota = (teplota * 9 / 5) + 32;
printf("Teplota v Fahrenheitech je: %.1f \n", teplota);
printf("Teplota v Kelvinech je: %.1f \n", teplota2);
}
else if (jednotka == 'F') {
printf("Zadejte teplotu v Fahrenheitech: ");
scanf("%f", &teplota);
teplota2 = ((teplota - 32) / 1.8) + 273.15;
teplota = ((teplota - 32) * 5) / 9;
printf("Teplota v Celsiech je: %.1f \n", teplota);
printf("Teplota v Kelvinech je: %.1f \n", teplota2);
}
else if (jednotka == 'K') {
printf("Zadejte teplotu v Kelvinech: ");
scanf("%f", &teplota);
teplota2 = teplota - 273.15;
teplota = ((teplota - 273.15) * 1.8) + 32;
printf("Teplota v Celsiech je: %.1f \n", teplota2);
printf("Teplota v Fahrenheitech je: %.1f \n", teplota);
}
else {
printf("%c je neplatná jednotka teploty", jednotka);
}
return 0;
}