jituTechnology

jituTechnology

Write a program that will read two numbers, and display the following menu:

This is the c source code/program for: Write a program that will read two numbers, and display the following menu:

MENU
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Square
6. Cube
/* a program to enter two number and perform the task as per menu
programmed by:Jitendra */
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
     int a,b,num,sq1,sq2,cub1,cub2;
   printf(“1.Addition\n2.Subtraction\n3.Multiplication \n4.Division \n5.Square \n6.Cube”);
   printf(“\nEnter the first value: “);
   scanf(“%d”,&a);
   printf(“Enter the second value: “);
   scanf(“%d”,&b);
   printf(“Enter your choice 1 to 6: “);
   scanf(“%d”,&num);
   switch(num)
   {
     case 1:
                printf(“The addition is %d”,a+b);
      break;
      case 2:
                printf(“The substraction is %d”,a-b);
      break;
      case 3:
                printf(“The multiplication is%d”,a*b);
      break;
      case 4:
                printf(“The division is%d”,a/b);
      break;
      case 5:
           sq1=pow(a,2);
            sq2=pow(b,2);
           printf(“The square of first value and second value is %d and\n%d”,sq1,sq2);
      break;
      case 6:
           cub1=pow(a,3);
           cub2=pow(b,3);
           printf(“The cube of first and second value is %d and\n%d”,cub1,cub2);
      break;
      default:
                printf(“This is not correct choice”);
   }
   getch();
}

No comments yet.

Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Connect with Me

GPO 8973 NPC 541; Kathmandu Nepal
Phone: +977 9851236800

Calendar

September 2025
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930