So i need to specify that they are integers, right ? :)
Driganka Mandal
Posts
-
Regarding Parameter in C (GCD of 2 Numbers) -
Regarding Parameter in C (GCD of 2 Numbers)Here is my Program In the line int GCD(num1,num2) I get the warning " warning: parameter names (without types) in function declaration [enabled by default]| " But if I use int GCD(int a,int b) the warning is not there. NOTE - In both cases the program runs perfectly. I am a newbie, so I would appreciate if someone helps me regarding this.... :) /* I am using mingw with code blocks */
#include<math.h>
#include<stdio.h>
#include<conio.h>int GCD(num1,num2);
main()
{
int num1,num2;
printf("\n\tEnter the two numbers whose GCD is to be found : ");
scanf("%d %d",&num1,&num2);printf("\\n\\tGCD of %d & %d is %d",num1,num2,GCD(num1,num2)); getch();
}
int GCD(int a ,int b)
{
if (b>a)
return GCD(b,a);
if(b==0)
return a;
else
return GCD(b,a%b);
}#include<math.h>
#include<stdio.h>
#include<conio.h>int GCD(num1,num2);
main()
{
int num1,num2;
printf("\n\tEnter the two numbers whose GCD is to be found : ");
scanf("%d %d",&num1,&num2);printf("\\n\\tGCD of %d & %d is %d",num1,num2,GCD(num1,num2)); getch();
}
int GCD(int a ,int b)
{
if (b>a)
return GCD(b,a);
if(b==0)
return a;
else
return GCD(b,a%b);
}#include<math.h>
#include<stdio.h>
#include<conio.h>int GCD(num1,num2);
main()
{
int num1,num2;
printf("\n\tEnter the two numbers whose GCD is to be found : ");
scanf("%d %d",&num1,&num2);printf("\\n\\tGCD of %d & %d is %d",num1,num2,GCD(num1,num2)); getch();
}
int GCD(int a ,int b)
{
if (b>a)
return GCD(b,a);
if(b==0)
return a;
else
return GCD(b,a%b);
}