This is a small Program i have written to perform the Basic Operations.
Here is my code for it. Please suggest to improve more.................3

#include <stdio.h>
#include <string.h>
int main()
{
	char operator;
	int num1, num2;
	//char operation[1]={'\0'};
	printf("Enter two numbers and operator to perform calculations!...\n");
	printf("Enter the operator: ");
	scanf("%c",&operator);
	printf("Enter num1: ");
	scanf("%d",&num1);
	printf("Enter num2: ");
	scanf("%d",&num2);

	if (operator=='+')
	{
		printf("Sum is %d\n",num1+num2);
	}
	else if (operator=='-')
	{
		printf("Difference is %d\n",num1-num2);
	}
	else if (operator=='*'){
		printf("Product is %d\n",num1*num2);
	}
	else if(operator=='/'){
		printf("Ratio is %d\n",num1/num2);
	}
	else
		printf("Not given any Operation.");
}

OUTPUT..........


Enter two numbers and operator to perform calculations!...

Enter the operator: +
Enter num1: 12
Enter num2: 13
Sum is 25

Suggest....................:pretty:

Please omit

//char operation[1]={'\0'};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.