CODE ONLINE PLEASE VISIT ANY OF THE FOLLOWING....

SIMPLE CALCULATOR USING C

#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');
  }






Comments

Popular posts from this blog

INTRODUCTION TO PYTHON

Fibonacci series by using c

TO FIND ODD NUMBERS UP TO N