CALCULATOR

 SOURCE CODE 


For BCA Students👉bca-wala.blogspot.com

About this Source Code:-

--You can build a simple calculator with C using switch cases or if-else statements. This calculator takes two operands and an arithmetic operator (+, -, *, /) from the user, however, you can expand the program to accept more than two operands and one operator by adding logic. Then, based on the operator entered by the user, it conducts the computation on the two operands. The input, however, must be in the format “number1 operator1 number2” (i.e. 2+4).


  See the full code below:-


  #include<stdio.h>
  #include<conio.h>
  void main()
      {
          float first,second;
          char ch;
          clrscr();
           printf("Calculate anything\n");
           scanf("%f %c %f",&first,&ch,&second);
           
          switch(ch)
               {
                 case '+':
                      printf("Addition is %.2f",first+second);
                      break;
                case '-':
                      printf("Subtraction is %.2f",first-second);
                      break;
               case '*':
                      printf("Multiplication is %.2f",first*second);
                      break;
              case '/':
                      printf("Division is %.2f",first/second);
                      break;
             case '%':
                      printf("Remainder is %.2f",first%second);
                      break;
              default :
                     printf("Invalid input!!");
                 }
          getch();
        }




For more Details go on that website bca-wala.blogspot.com

If you want to do Projects work in C Language. So << visit it >>here you see 15+ projects with there source codes. All Projects divided into three parts such as Beginner, Intermediates, Advance. 


 All things are write by Ankit Rai urf Ankit king😋
Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.