c program to find GCD of two non negetive numbers


Program to find GCD of Two Non Negetive numbers
Program
#include<stdio.h>
void main()
{
int x, y, temp;
printf("\nEnter any two Non Negetive Numbers : ");
scanf("%d%d", &x, &y);
while(y != 0)
{
temp = x % y;
x = y;
y = temp;
}
printf("\nThe GCD of Two Numbers is %d.", x);
}
Program to Print the multiplication table
Program
#include<stdio.h>
void main()
{
int num, counter = 1;
printf("\nEnter the Table Number to Generate : ");
scanf("%d", &num);
printf("\n\n\t\t\tPrinting Table\n\n");
while(counter <= 10)
{
printf("%d\t*\t%d\t= %d\n", num, counter, num * counter);
counter++;
}
}

No comments: