Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- nineth();
- return 0;
- }
- void first() {
- int a, b, c;
- printf("podaj liczb� a\n");
- scanf("%d", &a);
- printf("podaj liczb� b\n");
- scanf("%d", &b);
- printf("podaj liczb� c\n");
- scanf("%d", &c);
- int max;
- //rozwi�zanie pierwsze
- max = a;
- if(b > max) {
- max = b;
- }
- if(c > max) {
- max = c;
- }
- //rozwi�zanie drugie
- max = a;
- (b>max)?(max=b):max;
- (c>max)?(max=c):max;
- //wynik
- printf("najwi�ksza liczba to %d", max);
- }
- void second() {
- char a, b, c;
- printf("podaj liczb� a\n");
- scanf("%c", &a);
- printf("podaj liczb� b\n");
- scanf(" %c", &b);
- printf("podaj liczb� c\n");
- scanf(" %c", &c);
- char max;
- //rozwi�zanie pierwsze
- max = a;
- if(b > max) {
- max = b;
- }
- if(c > max) {
- max = c;
- }
- //rozwi�zanie drugie
- max = a;
- (b>max)?(max=b):max;
- (c>max)?(max=c):max;
- //wynik
- printf("najp�niej wyst�puje litera %c", max);
- }
- void third() {
- unsigned char a, b;
- printf("podaj liczb� a\n");
- scanf("%u", &a);
- printf("podaj liczb� b\n");
- scanf("%u", &b);
- unsigned char and = a&b;
- unsigned char or = a|b;
- unsigned char xor = a^b;
- printf("a AND b = dec: %u oct: %o hex: %x \n", and, and, and);
- printf("a OR b = dec: %u oct: %o hex: %x \n", or, or, or);
- printf("a XOR b = dec: %u oct: %o hex: %x \n", xor, xor, xor);
- }
- void fourth() {
- int a;
- short int b;
- double c;
- printf("int: %d , short int: %d , double: %lf", a, b, c);
- }
- void fifth() {
- int a, b;
- printf("podaj liczb� a\n");
- scanf("%d", &a);
- printf("podaj liczb� b\n");
- scanf("%d", &b);
- printf("wynik dzielenia: %d", a/b);
- }
- void sixth() {
- int a, b;
- printf("podaj liczb� a\n");
- scanf("%d", &a);
- printf("podaj liczb� b\n");
- scanf("%d", &b);
- if(a%b==0) {
- printf("%d", a);
- } else {
- printf("%d", b);
- }
- }
- void seventh() {
- int a;
- printf("podaj liczb�\n");
- scanf("%d", &a);
- printf("%d", a&1==0);
- if((a&1)==0) {
- printf("liczba ta jest parzysta");
- } else {
- printf("liczba ta jest nieparzysta");
- }
- }
- void eighth() {
- unsigned char a;
- printf("%u \n", a);
- a -= 1;
- printf("%u", a);
- //unsigned char jest 8 bitowy, bez bitu znaku, wi�c odj�cie 1 od 0 daj�ce liczb� ujemn� jest interpretowane jako liczba dodatnia 8 bitowa: 255
- }
- void ninth() {
- unsigned int a, b;
- printf("podaj liczb� a\n");
- scanf("%u", &a);
- printf("podaj liczb� b\n");
- scanf("%u", &b);
- unsigned int and = ~(~a|~b);
- printf("iloczyn bitowy a AND b: %u \n", and);
- unsigned int or = ~(~a&~b);
- printf("suma bitowa a OR b: %u", or);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement