P041.c (677B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to enter two numbers and check they are co-prime or not. 8 co-prime when HCF = 1 9 */ 10 11 #include <stdio.h> 12 int main() 13 { 14 int a, b, temp, temp_a, temp_b; 15 printf("Enter two number : "); 16 scanf("%d %d", &a, &b); 17 temp_a = a; 18 temp_b = b; 19 while (b > 0) 20 { 21 temp = a; 22 a = b; 23 b = temp % b; 24 } 25 if (a == 1) 26 { 27 printf("\n(%d, %d) is co-prime.", temp_a, temp_b); 28 } 29 else 30 { 31 printf("\n(%d, %d) is not co-prime.", temp_a, temp_b); 32 } 33 return 0; 34 }