初学C程序,练习写了一个,请高人指点
#include<stdio.h>
void main()
{
int f(int a,int b);
int num1,num2;
printf("input two numbers:\n");
scanf("%d,%d",&num1,num2);
c=f(a,b);
printf("gongyueshu is %d\n",c);
printf("gongbeishu is %d\n",num1*num2/c);
}
int f(int a,int b)
{
if(num1<num2)
{
int temp;
temp=num1;
num1=num2;
num2=temp;
}
a=num1;b=num2;
while(b!=0)
{
temp=a%b;
a=b;
b=temp;
}