Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h.>
- int eis ()
- {
- int N;
- do
- {
- printf ("Εισάγετε το πλήθος των διαφορετικών ακεραίων (7-49): \n");
- scanf ("%d",&N);
- }
- while ( N <= 6 || N > 49 );
- return N;
- }
- int * pin1(int N)
- {
- int ar, i, j, check;
- int *a;
- a=(int *)malloc(N*sizeof(int));
- for (i=1;i<=N;i++)
- {
- do
- {
- check = 1;
- do
- {
- if (check == 0)
- printf ("Ο αριθμός έχει ήδη εισαχθεί. Εισάγετε ξανά τον %dο αριθμό (1-49): ", i);
- else
- printf ("Εισάγετε τον %dο αριθμό (1-49): ", i);
- check = 1;
- scanf("%d", &ar);
- for (j=1; j<=i; j++)
- {
- if (ar== *(a+j))
- check = 0;
- }
- }
- while (check == 0);
- }
- while (ar<0 || ar>=50 );
- *(a+i)=ar;
- }
- return a;
- }
- int main()
- {
- int N;
- int *pin;
- system ("chcp 1253");
- N = eis();
- *pin = pin1(N);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement