Programs in C language
9. Program to find HCF of given number.#include<stdio.h> void main() { int a, b, i, n, hcf; clrscr(); printf("Enter any two numbers:"); scanf("%d%d",&a,&b); if(a>b) n=b; else n=a; for(i=1;i<=n;i++) { if(a%i==0 && b%i==0) hcf=i; } printf("HCF = %d",hcf); getch(); }Input :
60 24
Output :
HCF = 12
Father of C Language
Died: October 9, 2011, Murray Hill
Dennis Ritchie
Born: September 9, 1941, BronxvilleDied: October 9, 2011, Murray Hill