Hello every one. Welcome to today's C programming project. Today we will create a program using C which will take input of two numbers, the given number and the power. So, let's move to coding.
Download the Code Blocks compiler setup from here
Start Code Blocks and create a new project by clicking on "Create a New Project", Now select Files from left panel of the new Wizard, then give a name of your project and at last click on finish. Now a new project workspace will be created. Now type the below red color highlighted code in the blank page:
/*This program has been created by quvi.weebly.com- Author Mehbubul Hasan AL- Quvi. All rights reserved to Red Cross, 2012.
Date created and built on 31 December, 2012.*/
#include <math.h>
#include <stdio.h>
int main ()
{
int number, i, result;
printf ("Enter a number and its power (Separate by a space between them): ");
scanf ("%d %d", &number, &i);
result = pow (number, i);
printf ("\n%d to the power %d equals to %d", number, i, result);
return 0;
}
/*Sample created by Mehbubul Hasan AL- Quvi.*/
Now, go to the build menu and click on Compile current file.Hope you will find no error. Now again go to build menu and click on Run or press Ctrl+ F10. You will find the program working properly.
You will see the following output when you execute the program:
Enter a number and its power (Separate by a space between them):
Now, if you enter 2 3
You will see this,
2 to the power 3 is 8.
If you find any error or problem, please let me know them through your comments.
Oh! I forgot to tell that you can run this program online here
Happy coding!!
Download the Code Blocks compiler setup from here
Start Code Blocks and create a new project by clicking on "Create a New Project", Now select Files from left panel of the new Wizard, then give a name of your project and at last click on finish. Now a new project workspace will be created. Now type the below red color highlighted code in the blank page:
/*This program has been created by quvi.weebly.com- Author Mehbubul Hasan AL- Quvi. All rights reserved to Red Cross, 2012.
Date created and built on 31 December, 2012.*/
#include <math.h>
#include <stdio.h>
int main ()
{
int number, i, result;
printf ("Enter a number and its power (Separate by a space between them): ");
scanf ("%d %d", &number, &i);
result = pow (number, i);
printf ("\n%d to the power %d equals to %d", number, i, result);
return 0;
}
/*Sample created by Mehbubul Hasan AL- Quvi.*/
Now, go to the build menu and click on Compile current file.Hope you will find no error. Now again go to build menu and click on Run or press Ctrl+ F10. You will find the program working properly.
You will see the following output when you execute the program:
Enter a number and its power (Separate by a space between them):
Now, if you enter 2 3
You will see this,
2 to the power 3 is 8.
If you find any error or problem, please let me know them through your comments.
Oh! I forgot to tell that you can run this program online here
Happy coding!!