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
klasskru [66]
3 years ago
8

Write a recursive method to form the sum of two positive integers a and b. Test your program by calling it from a main program t

hat reads two integers from the keyboard and users your method to complete and print their sum, along with two numbers.
Computers and Technology
1 answer:
77julia77 [94]3 years ago
5 0

Answer:

see the code snippet below writing in Kotlin Language

Explanation:

fun main(args: Array<String>) {

   sumOfNumbers()

}

fun sumOfNumbers(): Int{

   var firstNum:Int

   var secondNum:Int

   println("Enter the value of first +ve Number")

   firstNum= Integer.valueOf(readLine())

   println("Enter the value of second +ve Number")

   secondNum= Integer.valueOf(readLine())

   var sum:Int= firstNum+secondNum

  println("The sum of $firstNum and $secondNum is $sum")

   return sum

}

You might be interested in
Write a function (named n_pointed_star) to make the turtle draw an n-pointed star. The function should return nothing, and accep
Andreyy89

Answer:

import sys

import turtle

import random

def n_pointed_star(total_points):

if total_points <= 4:

 raise ValueError('Not enough total_points')

area = 150

for coprime in range(total_points//2, 1, -1):

 if greatest_common_divisor(total_points, coprime) == 1:

  start = turtle.position()

  for _ in range(total_points):

   turtle.forward(area)

   turtle.left(360.0 / total_points * coprime)

  turtle.setposition(start)

  return

def greatest_common_divisor(a, b):

while b != 0:

 a, b = b, a % b

return a

   

turtle.reset()

n_pointed_star(5)

Explanation:

  • Inside the n_pointed_star function, check whether the total no. of points are less than or equal to 4 and then throw an exception.
  • Loop through the total_points variable and check whether the result  from greatest_common_divisor is equal to 1 or not and then set the starting position of turtle and move it.
  • Create the greatest_common_divisor which takes two parameters a and b to find the GCD.
  • Finally reset the turtle and call the n_pointed_star function.
8 0
3 years ago
If you had three extra siblings, what would be your birth order and what personalities would you like them to have?
Annette [7]

Answer:

mixed personalities l

that will be cool

3 0
3 years ago
Read 2 more answers
Do you think our attitude (whether positive or negative) is something we are born with or that we have power to control within o
Rom4ik [11]

Answer:

I think your attitude is something you develop

Explanation:

I think you develop your attitude and that effects the way you respond to something like if you've got a bad attitude and something bad just happened you tend to lash out and get mad or something but if you have good attitude and something bad just happened you would either brush it off or stay calm and fix it and there are a ton of different ways people react to different situations those were just examples I think your attitude is effect by the way you were raised if you were raised in a bad family your attitude would probably be mean or something.

5 0
3 years ago
Write a SELECT statement that returns these columns from the Products table: The list_price column The discount_percent column A
MA_775_DIABLO [31]

Answer:

SELECT  

   list_price,

   discount_percent,

   ROUND(list_price * discount_percent / 100,2) AS discount_amount

FROM

   Products;

Explanation:

6 0
3 years ago
What is the volume of the prism?
qaws [65]
I think 15 I'm not for sure..
8 0
3 years ago
Other questions:
  • Don is the superintendent of the county school system. What task might Don
    8·1 answer
  • What are the cause of eye strain during computer usage?
    7·1 answer
  • What is the simplest way to permanently get rid of an unwanted file? A. Go to the Start menu and then delete the file. B. Erase
    5·1 answer
  • Place the steps in order to keep a graphic from spilling over into the next page and to include the text it is assciated with.
    12·1 answer
  • The difference between a for loop and a while loop is that a for loop is a loop that happens for a certain number of times. A wh
    14·1 answer
  • A 5-stage MIPS pipeline has a register file without forwarding mechanism. How many NOPs (or bubbles) will you need to add to mak
    9·1 answer
  • Partes de la ventana principal de Microsoft excel 2013 con sus respectivas funciones
    14·1 answer
  • Project Description:
    8·1 answer
  • What is a motherboard​
    10·1 answer
  • Refer to Table 8-4. Consider the data above (in billions of dollars) for an economy: Gross domestic product (in billions of doll
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!