Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

–10 votes
asked Apr 3, 2018 by Power Murugan (190 points)
closed Sep 26, 2021 by Admin
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);
    }
closed with the note: answered

31 Answers

+9 votes
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!
commented Feb 19, 2020 by anonymous
Use math .h function
commented Feb 21, 2020 by anurag girmannagari (140 points)
wohooo fianally got the answer
commented May 5, 2022 by Sandesh Hegde (110 points)
Why math.h? it's a simple multiplication. math.h is not needed
0 votes
answered Apr 3, 2018 by vijaya Patil (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);
    }
+2 votes
answered Apr 6, 2018 by kodathalasudarshan reddy (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 Brijesh-Pandey (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 MAZE (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, 2021 by Hussein Abdiwahit Rithwan (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.
+1 vote
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, 2021 by Hussein Abdiwahit Rithwan (100 points)
You my miss some include iostream.
+1 vote
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 AD (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, 2021 by Hussein Abdiwahit Rithwan (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 .
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.
...