Answer:
int main()
{
int a,b,max,min;
cout<<"Enter 2 numbers\n";
cin>>a>>b; //asking numbers from user
max= a>b ? a : b; //using conditional operator to find larger
min= a>b ? b : a; //using conditional operator to find smaller
cout<<"\nLarger is "<<max;
cout<<"\nSmaller is "<<min;
return 0;
}
OUTPUT :
Enter 2 numbers
56
34
Larger is 56
Smaller is 34
Explanation:
- In the above program, first user is asked to enter 2 numbers which needs to be compared.
- Conditional operator - This operator contains syntax - (condition ? true : false) . This is a ternary operator in which first operand checks the condition and if its true second operand is returned otherwise third is returned.
- Then conditional operator is used twice first to find larger number and then smaller.
- At last both numbers are printed.
Answer:
if(goodsSold>500000){
bonus = 10000;
}
Explanation:
A complete Java program that prompts user to enter value for goodsSold is given below:
<em>import java.util.Scanner;</em>
<em>public class num14 {</em>
<em> public static void main(String[] args) {</em>
<em> Scanner in = new Scanner(System.in);</em>
<em> System.out.println("Enter goods Sold: ");</em>
<em> int goodsSold = in.nextInt();</em>
<em> int bonus =0;</em>
<em> if(goodsSold>500000){</em>
<em> bonus=10000;</em>
<em> }</em>
<em> System.out.println("You bonus for "+goodsSold+" is "+bonus);</em>
<em> }</em>
<em>}</em>
Answer:
Memory-mapped I/O and port-mapped I/O are two complementary methods of performing input/output between the central processing unit and peripheral devices in a computer. An alternative approach is using dedicated I/O processors, commonly known as channels on mainframe computers, which execute their own instructions.
Answer: forecast the project's timeline, estimate the level of effort and amount of resources needed. During this phase