bsc

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

root / semester_1 / tuition-c / P041.c

P041.c (541B)


      1 /* Write a program to enter two numbers and check they are co-prime or not.
      2     co-prime when HCF = 1
      3 */
      4 
      5 #include <stdio.h>
      6 int main()
      7 {
      8     int a, b, temp, temp_a, temp_b;
      9     printf("Enter two number : ");
     10     scanf("%d %d", &a, &b);
     11     temp_a = a;
     12     temp_b = b;
     13     while (b > 0)
     14     {
     15         temp = a;
     16         a = b;
     17         b = temp % b;
     18     }
     19     if (a == 1)
     20     {
     21         printf("\n(%d, %d) is co-prime.", temp_a, temp_b);
     22     }
     23     else
     24     {
     25         printf("\n(%d, %d) is not co-prime.", temp_a, temp_b);
     26     }
     27     return 0;
     28 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror