Logo 
Search:

Assembly Language Answers

Ask Question   UnAnswered
Home » Forum » Assembly Language       RSS Feeds
  Question Asked By: Meril Ramz   on Nov 28 In Assembly Language Category.

  
Question Answered By: Muhammed Athil   on Nov 28

I have a solution.. You must put a space b/w number and operator while running program...




Program
--------

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
char o;// is used to store operator
printf("please enter the numbers and the operator\nformat\n-------\nno1<space>opr<space>no2\n");
scanf("%d %c %d",&a,&o,&b);
clrscr();
if (o=='+')
{
printf("please enter the numbers and the operator\nformat\n-------\nno1<space>opr<space>no2\n");
printf("%d %c %d = %d",a,o,b,a+b);
}
if (o=='-')
{
printf("please enter the numbers and the operator\nformat\n-------\nno1<space>opr<space>no2\n");
printf("%d %c %d = %d",a,o,b,a-b);
}
if (o=='*')
{
printf("please enter the numbers and the operator\nformat\n-------\nno1<space>opr<space>no2\n");
printf("%d %c %d = %d",a,o,b,a*b);
}
if (o=='/')
{
printf("please enter the numbers and the operator\nformat\n-------\nno1<space>opr<space>no2\n");
printf("%d %c %d = %d",a,o,b,a/b);
}

getch();
}








Thankyou
for any help
smartathil@gmail.com

Share: