C++ Program To Find Gcd Of 3 Numbers Code Example


Example: c++ program to find gcd of 3 numbers

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

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable