gcd program in c
#include <stdio.h> int main() { int t, n1, n2, gcd; scanf("%d", &t); // Test Case Input while (t--) { scanf("%d %d", &n1, &n2);// Taking numbers input if (n2 > n1) { gcd = n1; n1 = n2; n2 = gcd; } while (n1 % n2 != 0) { gcd = n2; n2 = n1 % n2; n1 = gcd; } // n2 is our gcd printf("GCD: %d\n", n2); } return 0; }