Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

HCF or GCD of three numbers using Conditional or ternary Operator in C


#include <stdio.h>
int main() {
int a, b, c,H;
printf("Enter three different numbers: ");
scanf("%d %d %d", &a, &b, &c);
for(H=(a<b)?(a<c)?a:c:(b<c)?b:c;H>=1;H--)
if(a%H==0&&b%H==0&&c%H==0)
break;
printf("HCF is %d", H);
}