SIMPLE CALCULATOR USING C
- Get link
- X
- Other Apps
#include<stdio.h>
void main()
{
int a,b,c,e;
char d;
do
{
printf("Enter your choice:\n");
printf("MENU\n");
printf("1:Add\n2:sub\n3:mult\n4:div\n");
scanf("%d",&a);
switch(a)
{
case 1:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b+c;
printf("the sum between %d and%d is %d",b,c,e);
break;
case 2:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b-c;
printf("the diffrence between %d and%d is %d",b,c,e);
break;
case 3:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b*c;
printf("the multiplication between %d and%d is %d",b,c,e);
break;
case 4:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b/c;
printf("The division between %d and%d is %d",b,c,e);
break;
default:
printf("please enter valid input\n");
}
printf("\ndo you want to continue(y/n):");
scanf("%s",&d);
}while (d=='y');
}

void main()
{
int a,b,c,e;
char d;
do
{
printf("Enter your choice:\n");
printf("MENU\n");
printf("1:Add\n2:sub\n3:mult\n4:div\n");
scanf("%d",&a);
switch(a)
{
case 1:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b+c;
printf("the sum between %d and%d is %d",b,c,e);
break;
case 2:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b-c;
printf("the diffrence between %d and%d is %d",b,c,e);
break;
case 3:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b*c;
printf("the multiplication between %d and%d is %d",b,c,e);
break;
case 4:
printf("Enter 2 numbers:");
scanf("%d %d",&b,&c);
e=b/c;
printf("The division between %d and%d is %d",b,c,e);
break;
default:
printf("please enter valid input\n");
}
printf("\ndo you want to continue(y/n):");
scanf("%s",&d);
}while (d=='y');
}

- Get link
- X
- Other Apps
Popular posts from this blog
INTRODUCTION TO PYTHON
INTRODUCTION TO PYTHON Welcome! Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991. An interpreted language, Python has a design philosophy that emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax that allows programmers to express concepts in fewer lines of code than might be used in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale. Python features a dynamic type system and automatic memory management and supports multiple programming paradigms, including object-oriented, imperative, functional programming, and procedural styles. It has a large and comprehensive standard library.[26] Python interpreters are available for many operating systems, allowing P...
Comments
Post a Comment