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

–14 votes
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);
}

## 28 Answers

0 votes
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);
}

0 votes
answered Sep 24, 2018 by pushpesh kumar
int p in mul function definition is not inside the function make it declare in the function and give return 0 in main function
0 votes
answered Dec 15, 2019 by anonymous
In the above program, during the declaration of function you have written

int mul(int a,int b);

and when you have defined te function then you have written

int mul(int x,int y)

which is absolutely wrong. So your function should be defined like this :-

int mul(int a, int b)
0 votes
answered Dec 16, 2019 by (140 points)
#include <stdio.h>

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);
}
0 votes
answered Dec 16, 2019 by Dheeraj

You opened a brace after the first statement "int p;", where it should be after the function begins(before the statement). The entire function should be wrapped inside the braces.

int mul (int x, int y)
{

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

0 votes
answered Dec 17, 2019 by anonymous
Curly brace for function needs to be before int p; like ...int y){

Recommend defining function before main since easier to understand. This works:

#include <stdio.h>

int mul(int a, int b){
int p = a*b;
return p;
}

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);
}
0 votes
answered Dec 17, 2019 by vetri
use int p;

inside the function, basically inside the flower brackets or globally after the function declaration

int mul(int, int)

{

int p;

}
0 votes
answered Dec 17, 2019 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 = x*y;
return(p);
}
0 votes
answered Feb 7, 2020 by anonymous
multiplication of 5 and 10 is 50

5

10

50
0 votes
answered Feb 14, 2020 by anonymous
#include <stdio.h>

int mul(int x, int y){

int p;

p = x*y;

return p;
}

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);
}