{I am going write the c program but before you need a c compiler.there are a lot of compilers. like Code::Blocks, dev c++ Download dev c++ its free and install it in your computer.open dev c++ go to file-->new-->source file.}
#include<stdio.h>
#include<conio.h>
int mul(int a,int b);
main()
{
int a,b,c;
printf("enter first number\n");
scanf("%d",&a);
printf("enter second number\n");
scanf("%d",&b);
printf("%d*%d = %d",a,b,mul(a,b));
getch();
}
int mul(int x,int y)
{
int p;
p = x*y;
return(p);
}
For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}
IS IT HELPFIL? comment.
Thanks.. we can also calculate the power of a number using recursion as follows:
ReplyDeleteLet power(a, b) means ab.
If b is even : power(a, b) = power(a, b/2)*power(a, b/2);
if b is odd : power(a, b) = power(a, b/2)*power(a, b/2)*a;