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

–5 votes
asked Apr 3, 2018 by (100 points)
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);
    }

21 Answers

+1 vote
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);
there is your error!
0 votes
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);
    }
+1 vote
answered Apr 6, 2018 by (320 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) 

0 votes
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);
    }
0 votes
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);
    }
0 votes
answered Sep 18, 2018 by Fady Serhan

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

commented Sep 19, 2018 by anonymous
TRUE it is must in c language
0 votes
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
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);
    }

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...