# The following C program i have taken from book but output is not coming- Solution required- kindly help.

asked Apr 3, 2018 1 flag
int mul (int a, int b);
main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (a,b);
printf ("multipilcation of %d and %d is %d",a,b,c);
}
int mul (int x, int y)
int p;
{
p = x*y;
return(p);
}

answered Apr 3, 2018 by Yog
Once check this.

#include <stdio.h>
int mul (int a, int b);
main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (a,b);
printf ("multipilcation of %d and %d is %d",a,b,c);
}
int mul (int x, int y)
{
int p;
p = x*y;
return(p);
}
commented Feb 25, 2019 by Rahul
c = mul (a,b);
commented Feb 19, 2020 by anonymous
Use math .h function
commented Feb 21, 2020 by (140 points)
answered Apr 3, 2018 by (140 points)
#include<stdio.h>

int mul (int  *, int *);

void main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (&a,&b);
printf ("multipilcation of %d and %d is %d",a,b,c);
}
int mul (int *x, int *y)
{
int p;
p = (*x)*(*y);
return(p);
}
answered Apr 6, 2018 by (340 points)
Actually the program is correct but declaring local variable in function is old-style.so you may be using updated complier. so that  it may show error.
+1 vote
answered Apr 6, 2018 by (160 points)
#include<stdio.h>
int mul (int a, int b);
int main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (a,b);
printf ("multipilcation of %d and %d is %d",a,b,c);
}
int mul (int x, int y)

{

int p;
p = x*y;
return(p);
}
+1 vote
answered Apr 6, 2018 by anonymous

Use the same argument names while defining the function.

Use  int mul (int a, int b) instead of int mul (int x, int y)

answered Apr 10, 2018 by (140 points)
#include <stdio.h>

int mul (int a , int b );
main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (a,b);
printf ("multipilcation of %d and %d is %d",a,b,c);

return 0;
}
int mul (int x, int y)

{
int p;
p = x*y;
return (p);
}
commented Mar 3 by (100 points)
Actually the program is correct but declaring local variable in function is old-style.so you may be using updated complier. so that  it may shown an Error.
answered Sep 18, 2018 by anonymous
ThatÂ´s the code properly running. Cheers

#include <stdio.h>

int mul (int a, int b);
int main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (a,b);
printf ("multipilcation of %d and %d is %d",a,b,c);
}
int mul (int x, int y)
{
int p;

p = x*y;
return(p);
}
commented Mar 3 by (100 points)
You my miss some include iostream.

you just missed the library "#include <stdio.h>"

commented Sep 19, 2018 by anonymous
TRUE it is must in c language
answered Sep 22, 2018 by (140 points)
#include<stdio.h>
int mul (int a, int b);
main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (a,b);
printf ("multipilcation of %d and %d is %d",a,b,c);
}
int mul (int x, int y)
{
int p;

p = x*y;
return(p);
}

USe this is working
commented Mar 3 by (100 points)
In my opinion  this question some how it is correct on the other hand there is an erra  for the opening and closing brackets so the it  needs more repatition .
answered Sep 22, 2018 by anonymous

int mul (int a, int b);
main()
{
int a, b, c;
a = 5;
b = 10;
c = mul (a,b);
printf ("multipilcation of %d and %d is %d",a,b,c);
}
int mul (int x, int y)

{
int p;
p = x*y;
return(p);
}