Sunday 31 December 2017

simple C or C++ program to find addition , substraction , multiplication and divide without using any function.

In this program we simply define two variable a,b for getting values. A is define first value and b is define second value.And we also define some more variables for storing the operational value.In this program we find addition, substraction, multiplication and divide. so we also  declare variables add,sub,div,multi for storing values.

SIMPLE C PROGRAM TO FIND ADD , SUBSTRACT , DIVIDE AND MULTIPLY.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,add,sub,div,multi;
clrscr();

printf("Enter the value for A and B==");
scanf("%d%d",&a,&b);

add=a+b;
printf("Addition is:-%d".&add);

sub=a-b;
printf("Substract is:-%d".&sub);

div=a/b;
printf("Divide is:-%d".&div);

multi=a*b;
printf("Multiply is:-%d".&multi);

getch();
}


SIMPLE C++ PROGRAM TO FIND ADD , SUBSTRACT , DIVIDE AND MULTIPLY.

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,add,sub,div,multi;
clrscr();

cout<<"Enter the value for A and B:-";
cin>>a>>b;

add=a+b;
cout<<"Addition is:-"<<add;

sub=a-b;
cout<<"Substraction is:-"<<sub;

divide=a/b;
cout<<"Divide is:-"<<div;

multi=a*b;
cout<<"Multiplication is:-"<<multi;

getch();
}

No comments:

Post a Comment