Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- //#define csere(a,b) {if(a-b){a=a+b;b=a-b;a=a-b;}}
- #define sor2 printf("\n\n");
- //void tombfeltolt(double *t);
- int elso(int *t);
- int masodik(int *t);
- int harmadik(int *t);
- int negyzet(int n);
- int main()
- {
- unsigned int tomb[10], *t, a=0;
- t=tomb;
- printf("1 - \n");
- printf("2 - \n");
- printf("3 - \n");
- printf("ESC - Kilépés\n\n");
- //printf("");
- while(1)
- {
- a=getch();
- switch(a)
- {
- case '1':
- printf("\n\n1. %d", elso(t));
- break;
- case '2':
- printf("\n\n2. %d", masodik(t));
- break;
- case '3':
- printf("\n\n3. %d", harmadik(t));
- break;
- case 27 :
- exit(1);
- }
- }
- return 0;
- }
- int elso(int *t)
- {
- int i=0, szam=1000;
- while(i<=10)
- {
- if( ((negyzet(szam))==1) && ((szam%2)==1) )
- {
- *(t+i)=szam;
- printf(" %d ", *(t+i));
- i++;
- }
- szam--;
- }
- }
- int masodik(int *t)
- {
- }
- int harmadik(int *t)
- {
- }
- //Segéd fvek
- int negyzet(int n)
- {
- int a=2;
- while(a*a<=n)
- {
- if(a*a==n) return 1;
- a++;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment