Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char buf[256];
- char s[256];
- int a, b, c, t;
- printf("1. feladat\n");
- printf("\'Sikerult\' az \"elso\" feladat.\n\n");
- printf("2. feladat\n");
- printf("Elso szam: ");
- fgets(buf,sizeof(buf),stdin);
- a = atoi(buf);
- printf("Masodik szam: ");
- fgets(buf,sizeof(buf),stdin);
- b = atoi(buf);
- if(a > b)
- {
- t = a;
- a = b;
- b = t;
- }
- printf("Harmadik szam: ");
- fgets(buf,sizeof(buf),stdin);
- c = atoi(buf);
- t = 0;
- if(b > c)
- {
- if(a > c) t = a; else t = c;
- }
- else t = b;
- printf("A kozepso szam erteke: %d.\n\n",t);
- printf("3. feladat\n");
- printf("A vizsgalando szam: ");
- fgets(buf,sizeof(buf),stdin);
- a = atoi(buf);
- if((a % 7) > 0)
- printf("A szam nem oszthato 7-tel maradek nelkul.\n\n");
- else printf("A szam oszthato 7-tel maradek nelkul.\n\n");
- printf("4. feladat\n");
- printf("A vizsgalando szam: ");
- fgets(buf,sizeof(buf),stdin);
- a = atoi(buf);
- sprintf(s,"%d",a);
- if(strlen(s) == 2)
- printf("Elso szamjegy: %c\nMasodik szamjegy: %c\n\n",buf[0],buf[1]);
- else printf("A bemenet nem egy ketjegyu szam volt.\n\n");
- printf("ENTER utan befejezodik a program futasa.\n");
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement