// Addition Of Two Numbers Which r Taken From User!
/*Program Written by Maulin Thaker Ahmedabad;*/
#include
#include
void main()
{
float n1,n2,ans;
printf("Enter the First number\n");
scanf("%f",&n1);
printf("Enter the Second number\n");
scanf("%f",&n2);
ans=n1 + n2;
printf("Your Answer is -: %.3f",&ans);
}
public class Test {
public int add(int a, int b) {
return a + b;
}
public int sub(int a, int b){
return a - b;
}
public int mult(int a, int b){
return a * b;
}
public div(int a, int b){
return a/b;
}
}
# include < stdio.h >
# include < conio.h >
main ( )
{
int a,b,choice,result; /* Declare variables */
clrscr ( );
printf ( "1. Addition ");
printf ( "\n2. Subtraction ");
printf ( "\n3. Multiplication ");
printf ( "\n4. Division ");
printf( "\n Enter values of a,b=");
scanf ( %d%d", &a, &b); / * Input numbers variables */
printf ( " Enter your choice :-" );
scanf ( "%d" ,&choice); / * Input choice variable */
switch ( choice) /* Select any one choice */
{
Case 1:
result=a+b;
printf( " Addition = %d " ,result);
break;
Case 2:
result=a-b;
printf( "Subtraction = %d " ,result);
break;
Case 3:
result=a*b;
printf( "Multiplication = %d " ,result);
break;
Case 4:
result=a/b;
printf( " Division = %d " ,result);
break;
default:
printf ( " Your choice is wrong ");
}
getch( );
}
Output:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter values of a,b= 8 4
Enter your choice :- 2
Subtraction =4
void main() { int op; float a; float b; float result; printf("Enter the Arithmetic Operation: \n 1 - Addition\n 2 - Subtraction\n 3 - Multiplication\n 4 - Division\n 0 - Exit"); scanf("%d", &op); printf("Enter first number: "); scanf("%f", &a); printf("Enter second number: "); scanf("%f", &b); switch (op) { case 1: result = a + b; break; case 2: result = a - b; break; case 3: result = a * b; break; case 4: if (b == 0) { printf("Cannot divide by zero.");
getch(); exit(1); } result = a / b; case 0: exit(1); default: { printf("invalid choice"); } printf("The result is: %f", result); getch(); }
#include<stdio.h>
#include<conio.h>
void main[ ]
{
int a,b,p;
clrscr[ ];
print f [" enter the value of a,b \n" ];
scan f ["%d%d,&a,&b];
s=a+b;
print f["the sum of %d%d and %d is %d a,b si];
}
d=a-b
print f ["the difference of %d %d,;s,d,a,b,d;];
p=a*b
["product of %d%d', a,b,p];
q=a/b
print f ["the coefficient of %d %d is %d''a,b\n"];
get ch[ ];
}
# include<stdio.h>
void main()
{
int a,add,sub,mul,div,x,y;
printf("enter a number\n :");
scanf("%d",&x);
printf("enter another number\n :");
scanf("%d",&y);
printf("1=addition")
printf("2=subtraction");
printf("3=multiplication");
printf("4=division");
printf("enter tour choice\n :");
scanf("%d",a);
switch(a)
{
case 1:
add=x+y;
printf("addition of %d and %d is =%d\n",x,y,add);
break;
case 2:
sub=x-y;
printf("subtraction of %d and %d is =%d\n",x,y,sub);
break;
case 3:
mul=x*y;
printf("multiplication of %d and %d is =%d\n",x,y,mul);
break;
case 4:
div=x/y;
printf("division of %d and %d is =%d\n",x,y,div);
break;
default :
printf("wrong choice");
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n1, n2, ch ;
clrscr() ;
printf("Enter the first number : ") ;
scanf("%d", &n1) ;
printf("\nEnter the second number : ") ;
scanf("%d", &n2) ;
printf("\n[1] -> Addition ") ;
printf("\n[2] -> Subtraction ") ;
printf("\n[3] -> Multiplication ") ;
printf("\n[4] -> Division ") ;
printf("\n\nEnter your choice <1...4> : ") ;
scanf("%d", &ch) ;
switch(ch)
{
case 1 :
printf("\n%d + %d = %d", n1, n2, n1 + n2) ;
break ;
case 2 :
printf("\n%d - %d = %d", n1, n2, n1 - n2) ;
break ;
case 3 :
printf("\n%d * %d = %d", n1, n2, n1 * n2);
break ;
case 4 :
printf("\n%d / %d = %.2f", n1, n2, (float)n1 / n2);
break ;
default :
printf("\nInvalid choice");
break ;
}
getch();
}
email ThisBlogThis!Share to Twitter
A C program to divide, add, multiply and subtract two numbers; #include int main() { int first, second, add, subtract, multiply; float divide; printf("Enter two integersn"); scanf("%d%d", &first, &second); add = first + second; subtract = first - second; multiply = first * second; divide = first / (float)second; //typecasting printf("Sum = %dn",add); printf("Difference = %dn",subtract); printf("Multiplication = %dn",multiply); printf("Division = %.2fn",divide); return 0; }
Simple Switch is used to switch bank accounts from one bank to another. The switch is made in house and therefore causes the client less trouble. This is a new program placed on certain banks.
This is not a question.
Its simple!dirve a menu based prog by using switch case & then apply every sorting function to it.
A battery, a light bulb and a switch
The simple switch conducts in both directions. The ideal diode conducts in only one direction.
by pressing the on/off button
Simple Switch is used to switch bank accounts from one bank to another. The switch is made in house and therefore causes the client less trouble. This is a new program placed on certain banks.
a simple switch conduct current in both ways
a simple switch conduct current in both ways
how to prgram vlans on a switch
-- There may be a small hole in the back of the calculator labeled "reset". If so, the calculator may be reset by carefully inserting the end of a straightened paper-clip a slight distance into the hole, and pressing the tiny switch located just inside the hole. -- If such a reset switch is not provided, then the calculator is reset by momentarily disconnecting the battery.
how to program the new ign switch
program new keyswitch for 2003 odyssey
The simple machine in a light switch is a "lever".
Switch
It is very simple to install a dimmer switch in place of a regular light switch.
This free online Biweekly Mortgage Payment Calculator will calculate the bi-weekly payment and the time and interest savings that will occur if you switch from .