bsc

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

root / semester_1 / tuition-c / APC-PRAC-020.c

APC-PRAC-020.c (741B)


      1 /* Write a program to check if two number is co-prime or not */
      2 // File Name - amit0711202502.c (LAB), APC-PRAC-020.c (Local)
      3 
      4 // This code has not been compiled.
      5 // If you find any issues, please create a new issue on GitHub regarding them.
      6 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
      7 
      8 #include <stdio.h>
      9 
     10 int main()
     11 {
     12     int a, b, temp, temp_a, temp_b;
     13     printf("Enter the a and b : ");
     14     scanf("%d %d", &a, &b);
     15     temp_a = a, temp_b = b;
     16     while (b > 0)
     17     {
     18         temp = a;
     19         a = b;
     20         b = temp % b;
     21     }
     22     if (a == 1)
     23         printf("\n%d and %d is co-prime\n", temp_a, temp_b);
     24     else
     25         printf("\n%d and %d is NOT co-prime\n", temp_a, temp_b);
     26     return 0;
     27 }
© 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