Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int lnkofv(int a, int b);
- int main(void){
- int N;
- int db = 0;
- int lnko;
- int a;
- int b;
- scanf("%d", &N);
- srand (time(0));
- while(db <= N){
- a = rand()% 100+1;
- b = rand()% 100+1;
- lnko = lnkofv(a, b);
- if(lnko == 1) {
- db++;
- printf("%d %d", a, b);
- }
- }
- return 0;
- }
- int lnkofv(int a, int b){
- int temp;
- while(a>b){
- temp = b;
- b = a%b;
- a = temp;
- }
- return a;
- }
Advertisement
Add Comment
Please, Sign In to add comment