Simple Calculator in C Programming Language

Do you want to make a Calculator? If yes, then read bellow:

You will need a few tools and include:
1. Code Blocks IDE (Others are supported)
2. Code (Given Bellow)

These Codes were written by me in C. It is about 250 line of code and I wasted about 6or even more hours for it. Though it is a console program I have designed it very nicely. The Code is:


#include
#include
int main()
{
system("Color 2F");
system("TITLE Calculator in C by Nayeem");
int choise, a, b, c, d, e, f, g;
float num1, num2, num3;
char Z;
while(1)
{
num3 = 0;
printf("\n\n Welcome to Simple C Language Calculator\n");
printf(" =======================================\n\n\n");
printf(" Options:\n\n");
printf(" (1)--[+] (7)--[Namta]\n (2)--[-] (8)--[Namta (Advance)]\n (3)--[X] (9)--[Even Counter]\n (4)--[/] (10)-[Change Color]\n (5)--[Root] (11)-[Get System Information]\n (6)--[Power] (12)-[About]\n\n");
printf(" ");
printf(" Enter your choise (Type `0' to Close):");
scanf("%d", &choise);
if (choise==1) {
system("CLS");
printf("\n\n\n Give your values (eg. 2 space 2): ");
scanf("%f", &num1);
scanf("%f", &num2);
num3 = num1+num2;
printf("\n Result: %0.2f + %0.2f = %0.2f\n\n\n", num1, num2, num3);
system("Pause");
system("CLS");
}
else if (choise==2) {
system("CLS");
printf("\n\n\n Give your values (eg. 2 space 2): ");
scanf("%f", &num1);
scanf("%f", &num2);
num3 = num1-num2;
printf("\n Result: %0.2f - %0.2f = %0.2f\n\n\n",num1, num2, num3);
system("Pause");
system("CLS");
}
else if (choise==3) {
system("CLS");
printf("\n\n\n Give your values (eg. 2 space 2): ");
scanf("%f", &num1);
scanf("%f", &num2);
num3 = num1*num2;
printf("\n Result: %0.2f X %0.2f = %0.2f\n\n\n",num1, num2, num3);
system("Pause");
system("CLS");
}
else if (choise==4) {
system("CLS");
printf("\n\n\n Give your values (eg. 2 space 2): ");
scanf("%f", &num1);
scanf("%f", &num2);
if (num2==0) {
printf("\n Result : Math Error\n\n\n\n");
}
else {
num3 = num1/num2;
printf("\n Result: %0.2f / %0.2f = %0.2f\n\n\n", num1, num2, num3);
}
system("Pause");
system("CLS");
}
else if (choise==5) {
system("CLS");
printf("\n\n\n Give your values (eg. 9): ");
scanf("%f", &num1);
num3 = sqrt(num1);
printf("\n Result %f\n\n\n", num3);
system("Pause");
system("CLS");
}
else if (choise==6) {
system("CLS");
printf("\n\n\n Give your value than it's power (eg. 4 3): ");
scanf("%f", &num1);
scanf("%f", &num2);
num3 = pow(num1,num2);
printf("\n Result %f\n\n\n", num3);
system("Pause");
system("CLS");
}
else if (choise==0) {
break;
}
else if (choise>12 || choise<0 04="" 07="" 0="" 100="" 10="" 1="" 2="" 2f="" 4="" 54="" 57="" 5="" 67="" a="=0)" about:="" again="" alculator="" alve="" am="" an="" and="" ashiqur="" ause="" back="" be="" black="" book="" break="" c="" calculator="" choise="=11)" code="" color="" d="" distance="" e="" efault="" eg.="" ello="" ellow="" else="" end="" entered="" even="" f="" fe="" from="" g="" ghor="" ginning="" give="" green="" have="" i="" if="" ight="" in="" internet="" is:="" is="" it.="" lack="" language="" lear="" learn="" learning.grazie="" learnt="" lue="" my="" n="" namta="" nayeem.="" nayeem="" new="" ning="" number="" odd="" of="" olor="" on="" option="" options:="" opyright="" ou="" output="" over="" pause="" printf="" programming="" purple="" rahman="" read="" red="" reen="" result:="" return="" scanf="" search="" simple="" still="" system="" thank="" the="" thing="" this="" to="" try="" type="" urple="" value="" w="" welcome="" while="" white="" wrong="" x="" you="" your="">

If you don't want to Download IDE you can download the program compiled by me. Click here Download. Thanks for visiting my site.