It is easy if you study hard and Ace all of your six subjects. Including subjects that you are good at.
the compare instruction of 808 is used to compare the 2 operands. syntax: cmp op1,op2 algorithm: op1-op2 the value of the operands are not affected only the flags are updated if op1<op2 carry=1 and zero flag=0 if op1=op2 cy=0 and zf=1 if op1>op2 cy=0 and zf=0
1 score = 20
I made this in bluej(Free Java compiler) import java.io.*; import java.util.*; public class Calculator { public static void main(String args[]) { System.out.println("Make your arithmetic selection from the choices below:\n"); System.out.println(" 1. Addition"); System.out.println(" 2. Subtraction"); System.out.println(" 3. Multiplication"); System.out.println(" 4. Division\n"); System.out.print(" Your choice? "); Scanner kbReader = new Scanner(System.in); int choice = kbReader.nextInt(); if((choice<=4) && (choice>0)) { System.out.print("\nEnter first operand. "); double op1 = kbReader.nextDouble(); System.out.print("\nEnter second operand."); double op2 = kbReader.nextDouble(); System.out.println(""); switch (choice) { case 1: //addition System.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) ); break; case 2: //subtraction System.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) ); break; case 3: //multiplication System.out.println(op1 + " times " + op2 + " = " + (op1 * op2) ); break; case 4: //division System.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) ); } } else { System.out.println("Please enter a 1, 2, 3, or 4."); } } }
import java.io.*; import java.util.*; public class Calculator { public static void main(String args[]) { System.out.println("Make your arithmetic selection from the choices below:\n"); System.out.println(" 1. Addition"); System.out.println(" 2. Subtraction"); System.out.println(" 3. Multiplication"); System.out.println(" 4. Division\n"); System.out.print(" Your choice? "); Scanner kbReader = new Scanner(System.in); int choice = kbReader.nextInt(); if((choice<=4) && (choice>0)) { System.out.print("\nEnter first operand. "); double op1 = kbReader.nextDouble(); System.out.print("\nEnter second operand."); double op2 = kbReader.nextDouble(); System.out.println(""); switch (choice) { case 1: //addition System.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) ); break; case 2: //subtraction System.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) ); break; case 3: //multiplication System.out.println(op1 + " times " + op2 + " = " + (op1 * op2) ); break; case 4: //division System.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) ); } } else { System.out.println("Please enter a 1, 2, 3, or 4."); } } }
import java.io.*; import java.util.*; public class Calculator { public static void main(String args[]) { System.out.println("Make your arithmetic selection from the choices below:\n"); System.out.println(" 1. Addition"); System.out.println(" 2. Subtraction"); System.out.println(" 3. Multiplication"); System.out.println(" 4. Division\n"); System.out.print(" Your choice? "); Scanner kbReader = new Scanner(System.in); int choice = kbReader.nextInt(); if((choice<=4) && (choice>0)) { System.out.print("\nEnter first operand. "); double op1 = kbReader.nextDouble(); System.out.print("\nEnter second operand."); double op2 = kbReader.nextDouble(); System.out.println(""); switch (choice) { case 1: //addition System.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) ); break; case 2: //subtraction System.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) ); break; case 3: //multiplication System.out.println(op1 + " times " + op2 + " = " + (op1 * op2) ); break; case 4: //division System.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) ); } } else { System.out.println("Please enter a 1, 2, 3, or 4."); } } }
import java.io.*;import java.util.*;public class Calculator{public static void main(String args[]){System.out.println("Make your arithmetic selection from the choices below:\n");System.out.println(" 1. Addition");System.out.println(" 2. Subtraction");System.out.println(" 3. Multiplication");System.out.println(" 4. Division\n");System.out.print(" Your choice? ");Scanner kbReader = new Scanner(System.in);int choice = kbReader.nextInt();if((choice0)){System.out.print("\nEnter first operand. ");double op1 = kbReader.nextDouble();System.out.print("\nEnter second operand.");double op2 = kbReader.nextDouble();System.out.println("");switch (choice){case 1: //additionSystem.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) );break;case 2: //subtractionSystem.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) );break;case 3: //multiplicationSystem.out.println(op1 + " times " + op2 + " = " + (op1 * op2) );break;case 4: //divisionSystem.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) );}}else{System.out.println("Please enter a 1, 2, 3, or 4.");}}}Read more: How_do_you_make_calculator_program_in_java
The Boolean OP1 AND OP2 operates bit-by-bit, setting a 1 in the result if the corresponding bit in OP1 and OP2 are both 1's. A similar operation is the Boolean OP1 OR OP2 which sets a 1 in the result of the corresponding bit in either OP1 or OP2 are both 1.The number 5 is 101 in binary, while the number 4 is 100 in binary, so ANDing 5 and 4:101100=100Since the "ones" bit is 1 in the number 5 and not in 4, it is zero in the result.In Python the AND operator is "&", therefore in Pythona = 5 & 4"a" will be 4.
Java is used just about everywhere. Your phone, television, computer etc. Java is the most popular programming language. Example of Java: import java.io.*; import java.util.*; public class Calculator { public static void main(String args[]) { System.out.println("Make your arithmetic selection from the choices below:\n"); System.out.println(" 1. Addition"); System.out.println(" 2. Subtraction"); System.out.println(" 3. Multiplication"); System.out.println(" 4. Division\n"); System.out.print(" Your choice? "); Scanner kbReader = new Scanner(System.in); int choice = kbReader.nextInt(); if((choice<=4) && (choice>0)) { System.out.print("\nEnter first operand. "); double op1 = kbReader.nextDouble(); System.out.print("\nEnter second operand."); double op2 = kbReader.nextDouble(); System.out.println(""); switch (choice) { case 1: //addition System.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) ); break; case 2: //subtraction System.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) ); break; case 3: //multiplication System.out.println(op1 + " times " + op2 + " = " + (op1 * op2) ); break; case 4: //division System.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) ); } } else { System.out.println("Please enter a 1, 2, 3, or 4."); } } }
I HOPE THIS WILL HELP U OUT...ALGO GOES LIKE THIS: Reverrse prreffiix and evalluatte iittreverse given prefix expression;scan the reversed prefix expression;for each symbol in reversed prefixif operand thenpush its value onto stack S;if operator then {pop operand1;pop operand2;compute result = operand1 op operand2;push result back onto stack S;}return value at top of stack;AND EXAMPLE IS:Prefix: */-abc-+def Reversed: fed+-cba-/*ch action stackf push fe push f ed push f e d+ pop op1 f epop op2 fcalc &push f (d+e)- pop op1 fpop op2calc & push ((d+e)-f)c push ((d+e)-f) cb push ((d+e)-f) c ba push ((d+e)-f) c b a- pop op1 ((d+e)-f) c bpop op2 ((d+e)-f) ccalc & push ((d+e)-f) c (a-b)ch action stack/ pop op1 ((d+e)-f) cpop op2 ((d+e)-f)calc & push ((d+e)-f) ((a-b)/c)* pop op1 ((d+e)-f)pop op2calc & push ((a-b)/c)*((d+e)-f)
Alexandra Burke C/O SONY BMG Music Entertainment 9 Derry Street London, W8 5HY UK
Here is a calculator program I had to make in my Computer class in bluej (free java compiler) import java.io.*; import java.util.*; public class Calculator { public static void main(String args[]) { System.out.println("Make your arithmetic selection from the choices below:\n"); System.out.println(" 1. Addition"); System.out.println(" 2. Subtraction"); System.out.println(" 3. Multiplication"); System.out.println(" 4. Division\n"); System.out.print(" Your choice? "); Scanner kbReader = new Scanner(System.in); int choice = kbReader.nextInt(); if((choice<=4) && (choice>0)) { System.out.print("\nEnter first operand. "); double op1 = kbReader.nextDouble(); System.out.print("\nEnter second operand."); double op2 = kbReader.nextDouble(); System.out.println(""); switch (choice) { case 1: //addition System.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) ); break; case 2: //subtraction System.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) ); break; case 3: //multiplication System.out.println(op1 + " times " + op2 + " = " + (op1 * op2) ); break; case 4: //division System.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) ); } } else { System.out.println("Please enter a 1, 2, 3, or 4."); } } }
#include<stdio.h> #include<conio.h> #include<process.h> #include<string.h> #include<stdlib.h> struct treenode { char c; treenode * rlink; treenode * llink; }*stc[30],*temp,*root; char prefix[20],ch; int topt=-1,max=50,len; //global declaration void pusht(struct treenode * p); struct treenode* popt(); void tredis(struct treenode *ptr,int level); void exptree(); void post(struct treenode* p); void main() { clrscr(); printf(" Enter a prefix expression :"); scanf("%s",prefix); exptree(); tredis(root,1); printf(" The postfix expression is :"); post(root); getch(); } void post(struct treenode* p) { if(p!=NULL) { post(p->llink); post(p->rlink); printf("%c",p->c); } } void exptree() { len=strlen(prefix); int i=len-1; while(i>=0) { switch(prefix[i]) { case '+': case '-': case '*': case '/': case '^': temp=(struct treenode*)malloc(sizeof(struct treenode)); temp->c=prefix[i]; temp->llink=popt(); temp->rlink=popt(); pusht(temp); break; default : temp=(struct treenode*)malloc(sizeof(struct treenode)); temp->c=prefix[i]; temp->rlink=NULL; temp->llink=NULL; pusht(temp); } i--; } root=stc[topt]; } void pusht(struct treenode * p) { if(topt==max) { printf(" /**Beyond Capacity**/"); } else { stc[++topt]=p; } } struct treenode* popt() { if(topt==-1) printf(" /**No Expression**/"); else return(stc[topt--]); } void tredis(struct treenode *ptr,int level) { int i; if ( ptr!=NULL ) { tredis(ptr->rlink, level+1); printf(" "); for (i = 0; i < level; i++) printf(" "); printf("%c", ptr->c); tredis(ptr->llink, level+1); } }