#include<stdio.h>
void main()
{
int num1, num2,res;
char ch;
printf("\n Enter the 1st operand");
scanf("%d",&num1);
printf("\n Enter the operator");
scanf("%c",&ch);
printf("\n Enter the 2nd operand");
scanf("%d",&num2);
switch(ch)
{
case '+' :res=num1+num2; break;
case '-' :res=num1-num2; break;
case '*' :res=num1*num2; break;
case '/' :res=num1/num2; break;
}
printf("\n The result of %d %d %d is =%d",num1,ch,num2,res);
}
main()
{
int a,b,ch;
float result;
do
{
clrscr();
printf("select the operation from list");
printf("\n 1.ADDITION \n 2.SUBSTRACTION");
printf("\n 3.MULTIPLICATION \n 4.DIVISION");
printf("\n Enter your choice:");
scanf("%d",&ch);
}
while((ch>4)(ch<1));
switch(ch)
{
case1: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a+b;
printf("\n result=%f",result);
break;
case2: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a-b;
printf("\n result=%f",result);
break;
case3: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a*b;
printf("\n result=%f",result);
break;
case4: printf("\n enter two numbers:");
scanf("%d%d",&a,&b);
result=a/b;
printf("\n result=%f",result);
break;
}
getch();
}
#include<stdio.h>
#include<conio.h>
void add()
{
int a=10,b=10,sum;
sum=a+b;
printf("%d",sum);
}
void main()
{
int ch;
clrscr();
printf("Enter your choice:-");
scanf("%d",&ch);
switch(ch)
{
case 1:
add();
break;
}
getch();
}
If you any query about C Language so replay me my email fofandi.nirav@gmail.com
There are many different operators, which are you referring to?
Write a C program to Draw a RAINBOW and fill the suitable colors ...
write a note on event driven programming
you can use strstr()
Step 1. Learn the word "Fibonacci"...
a = b = c
There are many different operators, which are you referring to?
There is no simple answer because there is no simple rule for primes: it is certainly NOT an arithmetic progression.
give description of that then i will send the answer
Write a C program to Draw a RAINBOW and fill the suitable colors ...
Write a program in C for showing working of different logical operator in C.Your program should guide users with proper message/menu on the console. (5 Marks)
write a note on event driven programming
abhimanyu
you can use strstr()
Step 1. Learn the word "Fibonacci"...
The answer depends on what the explicit rule is!
dcdfsadf