Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<time.h>
- #include<stdlib.h>
- #include<math.h>
- #include <string.h>
- int main()
- {
- int m,n,N,G,i,v;
- long int sum=0;
- srand((unsigned) time(NULL));
- scanf("%d %d",&N,&G);
- int a[G],b[G],used[N+1];
- memset(used,0,N+1);
- for(m=0;m<G;m++)
- {
- do{
- n=rand()%N+1;
- }while(used[n]==1);
- used[n]=1;
- printf("%d",n);
- }
- printf("\nGuess %d number between 1-%d: ",G,N);
- scanf("%d",&i);
- for(m=0;m<G;m++)
- {
- v=pow((int)10.0000,m+1);
- if(v%10)
- b[m]=(i%v)/(v/10);
- printf("%d\n%d\n",v,b[m]);
- i=i-(b[m]*pow(10,m));
- printf("%d\n\n",i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement