Write a programe to add two numbers using function with return type"void".

Answers

Answer 1
Answer:

Answer:

#include<iostream>

using namespace std;

//create the function which add two number

void addTwoNumber(int num_1,int num_2)

{

   int result = num_1 + num_2;  //adding

   

   cout<<"The output is:"<<result<<endl;  //display on the screen

}

//main function

int main(){

   //calling the function

   addTwoNumber(3,6);

   return 0;

}

Explanation:

First, include the library iostream for using the input/output instructions.

then, create the function which adds two numbers. Its return type is void, it means the function return nothing and the function takes two integer parameters.

then, use the addition operation '+' in the programming to add the numbers and store the result in the variable and display the result.

create the main function for testing the function.

call the function with two arguments 3 and 6.

then, the program copies the argument value into the define function parameters and then the program start executing the function.


Related Questions

Assume that two computers are directly connected by a very short link with a bandwidth of 125 Mbps. One computer sends a packet of 1000 Bytes to the other computer. What’s the end-to-end delay (ignoring the propagation delay)?
Given the following: int funcOne(int n) { n *= 2; return n; } int funcTwo(int &n) { n *= 10; return n; } What will the following code output? int n = 30; n = funcOne(funcTwo(n)); cout << "num1 = " << n << endl; Group of answer choices Error num1 = 60 num 1 = 30 num1 = 600 num1 = 300
Consider the following two code segments, which are both intended to determine the longest of the three strings "pea", "pear", and "pearl" that occur in String str. For example, if str has the value "the pear in the bowl", the code segments should both print "pear" and if str has the value "the pea and the pearl", the code segments should both print "pearl". Assume that str contains at least one instance of "pea".I.if (str.indexOf("pea") >= 0){System.out.println("pea");}else if (str.indexOf("pear") >= 0){System.out.println("pear");}else if (str.indexOf("pearl") >= 0){System.out.println("pearl");}II.if (str.indexOf("pearl") >= 0){System.out.println("pearl");}else if (str.indexOf("pear") >= 0){System.out.println("pear");}else if (str.indexOf("pea") >= 0){System.out.println("pea");}Which of the following best describes the output produced by code segment I and code segment II?Both code segment I and code segment II produce correct output for all values of str.Neither code segment I nor code segment II produce correct output for all values of str.Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pear" but not "pearl".Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pearl".Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pea" but not "pear".
Which method can help you prevent RSI while using a keyboard?Keep the left-hand’s fingers on J, K, L, and ; keys. Rest the left-hand’s fingers on A,S, D, and F keys. Rest the right-hand’s fingers on A,S, D, and F keys. Rest the right-hand’s fingers on Q,W, E, and R keys.
For additional security and to optimize the performance of critical machines on your organization’s network, it is crucial to:___________.

Hello,Can you please help me with the following questions:
3. You enjoy technical matters, have a background in computer science and enjoy coding and playing video games in your free time. Which video game industry job would best match your profile?
a. Game tester
b. Producer
c. Programmer
d. Video game artist

6. Which of the following is an essential skill for game testers?
a. Thorough understanding of Java and C++
b. Technical drawing
c. Technical writing
d. Project management

9. Which of the following skills is the most important when applying for a game artist job?
a. Degree in arts
b. Strong art portfolio
c. Previous game testing experience
d, knowledge of scripting and codeing

10. The Stencyl program is recommended for ______.
a. creating 2D games
b. creating 3D games
c. Starting to learn to program
d. creating gaming art

11. You are passionate about video games, have spent part of your life in different countries and are fluent in their languages. You are considering looking for a job in video games. Which of the following jobs could you be qualified for, considering your skills and experience?
a. Game programming with a focus on languages
b. Translation
c. Game localization
d. Cultural gaming

12. Because it is one of the main programming languages used in some of the most popular game engines in the industry, which programming language does the author of the textbook recommend learning first?
a. Java
b. C Sharp
c. C++
d. SQL

13. Which of the following statements is NOT true about internships?
a. internships offer great opportunity to create and build connections within the industry.
b. Internships lead to a job offer upon successful completion
c. Internships offer an opportunity to get first-hand experience of the industry
d. Internships can be paid or unpaid

15. What is the best approach to take if you have not heard back from a company after applying for a job?
a. Wait, sometimes it takes time to process application and impatience can give a bad impression
b. Visit the company site personally to inquire about the status of your application
c. Try to find out on which side the process may be stalling and take appropriate steps to get the process moving forward, when possible
d. Reapply

18. You are applying for a game programmer job at a reputable gaming company. Your application may stand the best chance of being noticed if you include which of the following in your application?
a. List of all degrees and courses you have taken to acquire and hone your programming skills
b. Portfolio including samples of codes you have created
c. Portfolio including playable video game demo.
d. Portfolio of your artwork.

19. Which of the following is the most important item to include in your CV?
a. All gaming projects you have worked on, paid or unpaid.
b. Extracurricular activities related to gaming.
c. Major accomplishments
d. Short samples of code or technical writing samples.

20. Which of the following job hunting practices is the least effective?
a. Posting CV on job boards.
b. Searching for jobs on job posting sites
c. Doing an internship
d. Applying for a specific job posting via company website

Answers

Answer:

C, C, B, C, C, B, B or D, D, A or C, A, D

Explanation:

I am not taking whatever course you are taking, but I would like to know what you're taking. I have only answered the questions to the best of my abilities, so they might be wrong. Next time please award more points for a question so long.

How many times will the following loop display "Looping again!"? for(int i=0; i<=20; i++) cout << "Looping again!" << endl;

Answers

Answer:

21 times

Explanation:

Following are the description of output:

  • As it is for loop and The loop is started from the i=0 , after that check the condition 0<=20 condition is true .The control moves to the body of loop and it print Looping again! on the console window .After that it increment the value of i=i+1 .
  • Now i=1  1<=20  condition is true .The control moves to the body of loop and it print Looping again! on the console window .After that it increment the value of i=i+1 .
  • i=2 2<=20 condition is true .The control moves to the body of loop and it print Looping again! on the console window .After that it increment the value of i=i+1 .
  • ............soon
  • This process is executed again and again but when the value i=21 the loop condition is false .The loop is terminated .
  • As the loop is starts from the i=0 and executed less then equal to 20 therefore 21 times the loop is executed .

Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source. Nested lists The “*” operator List slices The “+=” operator A list filter A list operation that is legal but does the "wrong" thing, not what the programmer expects Provide the Python code and output for your program and all your examples.

Answers

Lists are used in Python to hold multiple values in one variable

(a) Nested list

A nested list is simply a list of list; i.e. a list that contains another list.

It is also called a 2 dimensional list.

An example is:

nested_list = [[ 1, 2, 3, 4]  , [ 5, 6, 7]]

(b) The “*” operator

The "*" operator is used to calculate the product of numerical values.

An example is:

num1 = num2 * num3

List slices

This is used to get some parts of a list; it is done using the ":" sign

Take for instance, you want to get the elements from the 3rd to the 5th index of a list

An example is:

firstList = [1, 2 ,3, 4, 5, 6, 7]

secondList = firstList[2:5]

The “+=” operator

This is used to add and assign values to variables

An example is:

num1 = 5

num2 = 3

num2 += num1

A list filter

This is used to return some elements of a list based on certain condition called filter.

An example that prints the even elements of a list is:

firstList = [1, 2 ,3, 4, 5, 6, 7]

print(list(filter(lambda x: x % 2 == 0, firstList)))

A valid but wrong list operation

The following operation is to return a single list, but instead it returns as many lists as possible

def oneList(x, myList=[]):

   myList.append(x)

   print(myList)

oneList(3)

oneList(4)

Read more about Python listsat:

brainly.com/question/16397886

Consider the following definition of a recursive method. public static int mystery(int[] list, int first, int last) { if (first == last) return list[first]; else return list[first] + mystery(list, first + 1, last); } Given the declaration int[] alpha = {1, 4, 5, 8, 9}; What is the output of the following statement? System.out.println(mystery(alpha, 0, 4)); a. 1 b. 18 c. 27 d. 32

Answers

Answer:

c. 27

Explanation:

  • In recursion method, a method calls itself until a condition becomes true and returned back. In mystery(), at first time, first is 0 and last is 4. Condition is checked and 0!=4 so else part is executed in which again mystery is called with first as 1 and last 4. This will go again and again until first=4.
  • When first=4 it is also equal to last so if part is executed and alpha[4] is returned which is 9, now it comes alpha[3] +9 which is 8+9 =17 .
  • It is returning values to its previous calls that is why it will reduce to alpha[0]+alpha[1]+alpha[2]+17 which is nothing but sum of all elements of a alpha
  • Then, 1+4+5+8+9=27.

)Which of following can be thrown using the throwstatement?? Error

? Throwable

? Exception

? RuntimeException

? All of Given

? None of given

Answers

Answer:

All of Given

Explanation:

The throw keywords can be used to throw any Throwable object. The syntax is :

throw <Throwable instance>

Note that Error and Exception are subclasses of Throwable while RuntimeException is a subclass of Exception. So the hierarchy is as follows:

Throwable

-- Error

-- Exception

   -- RuntimeException

And all of these are valid throwable entities. As a result "All of Given" is the most appropriate option for this question.

Answer:

The answer is B: throwable

Explanation:

Throwable is the super class of all exceptions

Pleases Help ME An example of a _________________ impact is when a product is back ordered and the business contacts the customer via email to let them know of the new ship date.A)Negative



B)Positive

Answers

Answer:

positive

Explanation:

it shows good customer service