C program find the GCD of the 2 numbers using functions

/*WAP to find the GCD of the 2 numbers using functions*/ #include<stdio.h> void main() { int gcd(int,int); int m,n; clrscr(); printf(“Input 2 Numbers-\n”); scanf(“%d%d”,&m,&n); printf(“GCD of %d and %d is %d”,m,n,gcd(m,n)); getch(); } int gcd(int x, int y) { while(x!=y) { if(x>y) x=x-y; else if(y>x) y=y-x; } return(x); } Output Input 2 Numbers- 12 24 … Read moreC program find the GCD of the 2 numbers using functions

C Program to find largest, smallest of 3 numbers

/*WAP to find largest, smallest of 3 numbers*/ #include<stdio.h> void main() { int a,b,c; clrscr(); printf(“Enter 3 Numbers-\n”); scanf(“%d%d%d”,&a,&b,&c); if(a>b) { if(a>c) printf(“%d Is Largest\n”,a); else printf(“%d Is Largest\n”,c); } else { if(b>c) printf(“%d Is Largest\n”,b); else printf(“%d Is Largest\n”,c); } if(a<b) { if(a<c) printf(“%d Is Smallest\n”,a); else printf(“%d Is Smallest\n”,c); } else { if(b<c) … Read moreC Program to find largest, smallest of 3 numbers