1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bingel [31]
3 years ago
11

Give an example of an operationin a programming languagethat is implemented.

Computers and Technology
1 answer:
Shtirlitz [24]3 years ago
4 0

answer:  

(i) #include <iostream>  

using namespace std;  

int main() {  

int n1,n2,max;  

cin>>n1>>n2;  

if(n1>n2)//finding maximum between n1 and n2 in the program directly.  

max=n1;  

else  

max=n2;  

cout<<max;  

return 0;  

}  

(ii)  

#include <iostream>  

using namespace std;  

int maximum(int n1 ,int n2)  

{  

if(n1>n2)//finding maximum between n1 and n2 using function.  

return n1;  

else  

return n2;  

}  

int main() {  

int n1,n2,max;  

cin>>n1>>n2;  

max=maximum(n1,n2);  

cout<<max;  

return 0;  

}  

(iii)  

#include <iostream>  

using namespace std;  

inline int maximum(int n1 ,int n2)  

{  

return (n1>n2)? n1:n2;  

}  

int main() {  

int n1,n2,max;  

cin>>n1>>n2;  

max=maximum(n1,n2);//Finding maximum using inline function.  

cout<<max;  

return 0;  

}  

Output:-  

54 78  

78  

all three codes give the same output.  

Explanation:  

In part (i) I have done the operation in the main function directly.  

In part(ii) I have used function to calculate the maximum.  

In part(iii) I have used inline function to calculate maximum.  

You might be interested in
What is the mid-square method?
Rom4ik [11]

Explanation:

Mid-Square Method:-In this method some it takes some digits from the square of a number.This number is a random number.This number can be used as a key for hashing.

This technique is mostly used in hashing so decrease the collision in hash maps.

This method has  a limitation that when we square a large number it may go out of range of integer so we have handle those cases.

8 0
3 years ago
What is one of the main problems that can occur when Implementing a large number of new systems within an organization
Mariulka [41]
I would probably say ‘A’ or ‘D’
7 0
3 years ago
Are you concerned that strangers may have access to the personal information you share on social media platforms? Why or why not
GuDViN [60]
It makes me a little uneasy at times, yes, but I know that they cannot find me unless I share way too much.
Hope this helps~!
~{Oh Mrs. Believer}
4 0
3 years ago
At some point in your driving career, you will most likely be faced with an oncoming vehicle swerving into your travel lane. tru
aleksley [76]

I believe the answer is True.

7 0
4 years ago
Which type of financial institution typically has membership requirements?
Anon25 [30]
Credit Union typically has membership requirements
8 0
4 years ago
Other questions:
  • What are the functions of a motherboard??
    6·1 answer
  • Which one of the following is not the name of a 20th century school composition
    14·2 answers
  • A mobile base station (BS) in an urban environment has a power measurement of 15 µW at 175 m. If the propagation follows an inve
    9·1 answer
  • Which of the following code correctly registers a handler with a button btOK?a. btOK.setOnAction(e -&gt; System.out.println("Han
    6·1 answer
  • Networking device converts analog signals to digital ones?
    8·1 answer
  • Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
    9·1 answer
  • What is the point of brainy when other people have to answer your questions but not the cumputer
    9·1 answer
  • Which feature should be used prior to finalizing a presentation to ensure that audience members with disabilities will be able t
    13·2 answers
  • You’ve been tossed into an insane asylum. What do you tell the people there to prove to them that you don’t belong inside?
    7·2 answers
  • I have a .NET 6 basic website that I built using Entity Framework as the database for updating pages. I am ready to deploy the s
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!