bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

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 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror