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
Pls someone help me with these four questions
ipn [44]

Answer:

16. Grace Hopper. 1959.

8 0
2 years ago
A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, cell A3 contains 7. You enter in cell A4 the fo
lesya [120]
The value displayed in A4 is 24
5 0
2 years ago
Write a class called MagicSquare, which contains a single method called check that accepts a two-dimensional array as an argumen
ira [324]

Answer:

public class MagicSquare {

   public static void main(String[] args) {

       int[][] square = {

               { 8, 11, 14, 1},

               {13, 2, 7,12},

               { 3, 16, 9, 6},

               {10, 5, 4, 15}

       };

       System.out.printf("The square %s a magic square. %n",

               (isMagicSquare(square) ? "is" : "is not"));

   }

   public static boolean isMagicSquare(int[][] square) {

       if(square.length != square[0].length) {

           return false;

       }

       int sum = 0;

       for(int i = 0; i < square[0].length; ++i) {

           sum += square[0][i];

       }

       int d1 = 0, d2 = 0;

       for(int i = 0; i < square.length; ++i) {

           int row_sum = 0;

           int col_sum = 0;

           for(int j = 0; j < square[0].length; ++j) {

               if(i == j) {

                   d1 += square[i][j];

               }

               if(j == square.length-i-1) {

                   d2 += square[i][j];

               }

               row_sum += square[i][j];

               col_sum += square[j][i];

           }

           if(row_sum != sum || col_sum != sum) {

               return false;

           }

       }

       return d1 == sum && d2 == sum;

   }

}

5 0
2 years ago
A2 Suggest why the Petri dish and agar jelly needed to be sterile.​
Mashcka [7]

A Petri dish (Petri plate) is a shallow cylindrical glass lidded dish that is typically used to culture microorganisms (agar plates). There are glass and plastic Petri dishes, and both can be sterilized (using an autoclave) and re-used. Before being used for culture purposes, it is important to ensure that the Petri dish is not only clean, but also sterile. This helps prevent the contamination of the new culture.Agar is a polymer made up of various sub-units of galactose and various species of red algae. Although it has other uses including culinary and dentistry, agar plays an important role in microbiology as culture media for a variety of microorganisms.As compared to some of the other alternatives like gelatin, agar has a number of advantages which include:Cannot be easily degraded by microorganism Stronger Firmer than gelatin

6 0
2 years ago
After you use the create sequence statement to create a sequence, you can use the _______________________ pseudo column to get t
user100 [1]

After you use the create sequence statement to create a sequence, you can use the NEXTVAL  pseudo column to get the next value in the sequence.

<h3 /><h3>How do you create a sequence?</h3>
  • You must have the Create any sequence system privilege to create a sequence in another user's schema.
  • Specify the schema that will hold the sequence.
  • If you leave out schema, Oracle Database will create the sequence in your own schema. Name the sequence that will be created.
  • Pseudo-columns allow selection, but you cannot edit, update, or remove their values.
  • A pseudo-column is analogous to a function that does not accept any inputs. This section goes over the two pseudo-columns, CURRVAL and NEXTVAL.
  • A pseudo column is a "column" that displays a value when a value is selected but is not one of the table's true columns.
  • Two examples are SysDate and RowID. It is frequently used in tandem with the DUAL table.
  • After you utilize the make sequence statement to make a sequence, you can utilize the NEXTVAL pseudo column to obtain the next value in the sequence.

To learn more about NEXTVAL, refer to:

brainly.com/question/13043887

#SPJ4

3 0
8 months ago
Other questions:
  • When reading data across the network (i.e. from a URL) in Python 3, what string method must be used to convert it to the interna
    9·1 answer
  • Write a C program that has the following statements: int a, b; a = 10; b = a + fun(); printf("With the function call on the righ
    12·1 answer
  • How did tafts accomplishments regarding conservation and trust-busting compare to roosevelt?
    11·1 answer
  • A parameter is a numerical measure that describes a characteristic of a sample. Choose One • 4 points True False
    6·1 answer
  • Relation between training and occupation with examples in points . Plz tell fast<br> ​
    5·1 answer
  • What are the top and side margins for a letter typed in standard format?
    11·1 answer
  • You are going to do a bubble sort on the following list. What are the missing members of the list? Select 3 options.
    14·2 answers
  • Is a defense of a political position an argument
    7·1 answer
  • What is also known as computer Network?
    6·2 answers
  • Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right or left. Initially, the bu
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!