Conside following prototype of a function
int minArray(int [], int );
Which of the option is correct way of function CALL assuming following arraydeclaration
int x[5] = {7,4,6,2,3};*
a) minArray(x,5);
b) minArray(x[],10);
c) minArray(x[5],5);
d) minArray(5,x);

Answers

Answer 1

Answer:

The answer is "Option a"

Explanation:

Following are the code to this question:

#include <stdio.h>//header file

int minArray(int x[], int n)//defining method minArray that accepts two parameters

{

   for(int i=0;i<n;i++)//defining loop for print value

   {

    printf("%d\n",x[i]);//printf array value

   }

}

int main()//defining main method

{

int x[] ={7,4,6,2,3};//defining array that hold values

int n=5;//defining integer variable

minArray(x,5);//calling method minArray

return 0;

}

In this code, a method "minArray" is defined, that accepts two parameters array and an integer variable in its parameter, and in the next step, the for loop is declared, that uses the print method to prints its value.

In the next step, the main method is declared, which declared an array and holds its values and defines an integer variables, and calls the method "minArray".


Related Questions

A specification can be a written document, a set of graphical, a formal mathematical model, a collection of usage scenarios (or, use cases), a prototype, or any combination of these.
A. True
B. False

Answers

Answer:

The given statement is "True". A further explanation is given below.

Explanation:

The specification would be a necessary condition that is explicitly indicated, for obvious reasons, concerning the great components throughout the prototype of being something. A detailed explanation of that same performance aspects, normally with particular established standards, is presented in terms appropriate to lead to the creation both for real manufacturing and building methods of such a component with either the personality traits mentioned throughout the structural performance.

So the above is the appropriate response.

Write a program that reads an integer between o and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all the digits is 14. Hint: Use the % operator to extract digits, and use the / operator to remove the extracted digit. For instance, 932 % 10=2 and 932/10 =93. Here is a sample run:
Enter a number between 0 and 1000 : 999
The sum of digits is 27.

Answers

Answer:

Answered below

Explanation:

#Program is written in Python programming language

digit = 0

sum = 0

num = int(input("Enter a number between 0 and 1000: ")

#Check that number is within the valid range

if num > 0 and num <= 1000:

while num != 0:

#Isolate each digit

digit = num % 10

sum = sum + digit

#Remove isolated digit from number

num = num/10

else:

print("Number is not within valid range")

#print total sum of digits

print(sum)

The Circle and CircleTester have been created, but they have errors. The public and private settings for variables and methods are not all correct.
Your job is to go through and fix them. You will need to make edits in both files to get them working correctly, but once complete, your output should match the output below.
Sample Output:
Circle with a radius of 5.0
The diameter is 10.0
The perimeter is 31.41592653589793
CIRCLE.JAVA
public class Circle {
public double radius;
private Circle(double myRadius) {
radius = myRadius;
private void setRadius(int myRadius){
radius = myRadius;
}
private double getDiameter() {
return radius*2;
}
public double getRadius() {
return radius;
}
private double getPerimeter() {
return Math.PI*getDiameter();
}
private String toString() {
return "Circle with a radius of " + radius;
}
}
CIRCLE TESTER.JAVA
public class CircleTester {
public static void main(String[] args) {
Circle circ = new Circle(10);
circ.radius = 5;
System.out.println(circ);
System.out.println("The diameter is " + circ.getDiameter());
System.out.println("The perimeter is " + circ.getPerimeter())
}
}

Answers

Answer:

CIRCLE.JAVA

public class Circle {

  private double radius;

  public Circle(double myRadius) {

    radius = myRadius;

    private void setRadius(int myRadius){

    radius = myRadius;

 }

 public double getDiameter() {

    return radius*2;

 }

 public double getRadius() {

   return radius;

 }

 public double getPerimeter() {

   return Math.PI*getDiameter();

 }

 public String toString() {

    return "Circle with a radius of " + radius;

 }

}

CIRCLE TESTER.JAVA

public class CircleTester {

 public static void main(String[] args) {

    Circle circ = new Circle(10);

    circ.radius = 5;

    System.out.println(circ);

    System.out.println("The diameter is " + circ.getDiameter());

    System.out.println("The perimeter is " + circ.getPerimeter())

 }

}

Explanation:

public class Circle {

  //This could be made private or public.

  //Making it private is better

  private double radius;

  //This is a constructor. It should be made public

  //since it would most likely be used in another class

  //to create an object of this class.

  //Making it private means no other external class can create

  //an object of this class.

  //Since the tester class (CIRCLETESTER.java), as shown on line 3,

  // needs to create

  //an object of this class, this should be made public

  public Circle(double myRadius) {

    radius = myRadius;

    private void setRadius(int myRadius){

    radius = myRadius;

 }

 //This should be made public since it will be

// used in another class (CIRCLETESTER.java in this case)

 public double getDiameter() {

    return radius*2;

 }

 public double getRadius() {

   return radius;

 }

 //This should be made public since it will be

 //used in another class (CIRCLETESTER.java)

 public double getPerimeter() {

   return Math.PI*getDiameter();

 }

 //The toString() method is the string representation

 //of an object and is called when there is an attempt to

 //print the object. It should be made public since it will

 //be used in another class (CIRCLETESTER.java)

 public String toString() {

    return "Circle with a radius of " + radius;

 }

}

CIRCLE TESTER.JAVA

public class CircleTester {

 public static void main(String[] args) {

    Circle circ = new Circle(10);

    circ.radius = 5;

    System.out.println(circ);

    System.out.println("The diameter is " + circ.getDiameter());

    System.out.println("The perimeter is " + circ.getPerimeter())

 }

}

What email program would you suggest and why?

Answers

Answer:

An email program

Explanation:

And why?

Answer:

I would suggest g m a i l.

Explanation:

I use G m a i l all the time and I think it is easy to use! A lot of people think it is great too! :)

what time is spellrd the same forwards and backwards​

Answers

12:21 is the correct answer

ve phenotypk percentages of the offspring​

Answers

It’s true have a nice day

At Moore High, 456 students attended the prom. This is 65 more students than
the previous year.
To the nearest percent, what is the percent of increase from last year to this
year?
12%
15%
17%
19%

Answers

Answer:

B-15%

Explanation:

Yes I agree the answer is B 15%

Assuming dataFile is an ofstream object associated with a disk file named payroll.dat, which of the following statements would write the value of the salary variable to the file
A) cout < B) ofstream C) dataFile << salary;
D) payroll.dat <

Answers

Answer:

dataFile << salary;

Explanation:

To write salary to a file (payroll.dat) using ofstream, you make use of the following instruction:

ofstream dataFile;

myfile.open ("payroll.dat");

myfile <<salary;

myfile.close();

This line creates an instance of ofstream

ofstream dataFile;

This line opens the file payroll.dat

myfile.open ("payroll.dat");

This is where the exact instruction in the question is done. This writes the value of salary to payroll.dat

myfile <<salary;

This closes the opened file

myfile.close();

1.16 LAB: Input and formatted output: House real estate summary Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (currentPrice * 0.051) / 12 (Note: Output directly. Do not store in a variable.).
Ex: If the input is:
200000 210000
the output is:
This house is $200000. The change is $-10000 since last month.
The estimated monthly mortgage is $850.0.
Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of programming.
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int currentPrice;
int lastMonthsPrice;
currentPrice = scnr.nextInt();
lastMonthsPrice = scnr.nextInt();
/* Type your code here. */
}

Answers

Answer:

Please find the complete code and the output in the attachement.

Explanation:

In the code, a class "LabProgram" is defined, and inside the main method two integer variable "currentPrice and lastMonthsPrice" is defined that uses the scanner class object is used for a user input value, and in the next step, two print method is declared that print the calculate of the integer variable.

The program is an illustration of output formats in Java

The statements that complete the program are:

System.out.printf("This house is $%d. The change is $%d since last month.\n",currentPrice,(currentPrice - lastMonthsPrice));System.out.printf("The estimated monthly mortgage is $%.1f.\n",(currentPrice * 0.051)/12);

To format outputs in Java programming language, we make use of the printf statement, followed by the string literal that formats the required output

Take for instance:

To output a float value to 2 decimal place, we make use of the literal "%.2f"

Read more about Java programs at:

https://brainly.com/question/25458754

Exercise 1.3.5: Expressing conditional statements in English using logic. info About Define the following propositions: c: I will return to college. j: I will get a job. Translate the following English sentences into logical expressions using the definitions above: (a) Not getting a job is a sufficient condition for me to return to college. (b) If I return to college, then I won't get a job. (c) I am not getting a job, but I am still not returning to college. (d) I will return to college only if I won't get a job. (e) There's no way I am returning to college. (f) I will get a job and return to college..

Answers

hope this helps!!!. i worked hat

Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex:
5.
7.
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again. (Notes)
1 #include
2 #include //
3 Enables use of rand ()
4 int main(void) ( int seedval;
6.
7. scanf ("%d", &seedval);
8.
9.
10 srand(int seedval);
11 printf("%d\n", srand());
12 printf("%d\n", srand());
13
14 return e;
15 }

Answers

Answer:

#include<stdio.h>

#include<stdlib.h>

int main(void){

int seedval;

scanf ("%d", &seedval);

srand(seedval);

printf("%d\n", rand()%10);

printf("%d\n", rand()%10);

 return 0;

}

Explanation:

The given code is poorly formatted. So, I picked what is usable from the code to write the following lines of code:

#include<stdio.h>

#include<stdlib.h>

int main(void){

This line declares seedval as integer

int seedval;

This line gets user input for seedval

scanf ("%d", &seedval);

This line calls the srand function to generate random numbers

srand(seedval);

This prints a random number between 0 and 9

printf("%d\n", rand()%10);

This also prints a random number between 0 and 9

printf("%d\n", rand()%10);

 return 0;

}

Boolean, integer, string, and float are examples of:
constants.
recursions.
loops.
variables.

Answers

Answer:

variables

Explanation:

They are all examples of variables
Other Questions
The dimensions of a cylindrical water tank are shown below.18 ydo58,320 yd3,240 yd60 ydO19,440 yd15,270 yd3Which of the following is the best estimate of the volume ofthis water tank? I NEED HELP PLS HURRY The town of Franklin has an economy composed entirely of two equally sized specialized tire manufacturers. Both company X and company Z produce race car tires and airplane tires. Company X is better at producing race car tires than Company Z which is better at producing airplane tires. In order to maximize output, Company X should:_________ a. reduce its production of race car tires in order to commit resources to learn how to better produce airplane tires. b. abandon the production of airplane tires to fully specialize in the production of race car tires and then trade with Company Z for airplane tires. c. keep producing both products at the going rate. d. produce both race car tires and airplane tires on its own and sell its excess race car tires to Company Z for additional airplane tires. A Kentrell le gusta jugar ftbol americanol es _________. atlticos atltico atlticas atlticos please help me guys lol? What is .09375 as a fraction what is the result of cell that undergo division by mitosis Which expression shows 10 less than anumber n?A n + 10B 10nC 10-nDn-10 PLEASE HELP I WILL GIVE YOU THE BRAINLIEST ANSWER PLEASEE help pleseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee i think i spelled that wrong but stillplese help 6 identical toys weigh 1.8kg. a) convert 1.8kg to grams. b) what is the weight of one toy? Give your answer in grams. c) how much would 4 toys weigh? Give your answer in kilograms An ounce of almonds costs $1.40. If Joey buys 2.4 ounces of almonds, how much will he have to pay? Jane works at The Bottling Company. She needs to put 8,500 bottles of water into cases. So far she has put 2,136 in cases. How many cases can Jane fill with the remaining bottles? How many bottles will be left? Helppp please !Ill give crown to whoever is first Hey! Im writing a story and need some ideas on what should happen next. About thirty minutes later, I hear a car horn outside my apartment. This is it. The moment Im going to enter the car of the person Im supposed to hate. Why did I tell him Id go to the park with him? I walk out and try to open the car door, its locked. I knock on the window and mouth to him that the door is locked. He nods his head and starts laughing at me. I knew this was a bad idea. He is awful! I angrily glare at him for a few seconds until he finally unlocks the door and lets me in. When I enter the car I ask him, Why did you do that? He laughs and says, Because it was funny. I roll my eyes and say, No it wasnt. He starts the car then says, Wow, not even thirty seconds with me and youre already rolling your eyes? I glare at him for what feels like forever and he makes another sarcastic comment, Sunflower, if you wanna stare at me, you should take a picture. It lasts longer. Ugh! Youre so annoying, Im so regretting coming with you! He grins and keeps on driving. I honestly still have no idea why he invited me but I guess Ill never know. After minutes of awkward silence, I decide to say something. So pretty boy, why did you invite me to the park? He looks over at me and says, I have a name you know. Yeah, so do I, but yet, you never use it. He smiles at me. True, he says. I smile. Im really getting used to this fun side of him. Hang on, what? What am I saying? Getting used to him? No, never. I get rid of that thought and as I do, he parks the car and says, Here we are. Are you ready to have fun? I look over at him and respond, Im with you, Im not sure how much fun I can actually have. He rolls his eyes and says, Right back at you. Youre no fun either. I ignore him and we get out of the car.What should happen while these two are at the park? (By the way, these two always argue they basically hate eachother. Seth (the guy driving) made a bet on Sila (the girl he is with) That is just a little background info. PS I did already ask this question and I got some creative people to help me, Im just looking for a variety of ideas :) A tall plant (TT) is crossed with a short plant (tt). What is the genotype?Use a punnett square to solve.OTT: 2/4; Tt: 2/4;tt: 0/4TT: 2/4; Tt: 1/4;tt: 1/4TT: 0/4; Tt: 4/4;tt: 0/4TT: 1/4; Tt: 2/4;tt: 1/4 Questlon 23 of 30What is the term for a large group of people with similar characteristics suchas educational background and income level?A. An interest groupB. A social classC. A social cultureO D. A political partySUBMIT PLEASE HELP MAKING BRAINLIEST IF CORRECT hich two phrases in this passage point to the meaning of the word stealthily?The question in her mind, and one not easily solved, now was, 'How can I get away?' So, as was her usual custom, she 'told God she was afraid to go in the night, and in the day every body would see her.' At length, the thought came to her that she could leave just before the day dawned, and get out of the neighborhood where she was known before the people were much astir. 'Yes,' she said, fervently, 'that's a good thought! Thank you, God, for that thought!' So, receiving it as coming direct from God, she acted upon it, and one fine morning, a little before day-break, she might have been seen stepping stealthily away from the rear of Master Dupont's house." direct from Godget away bulk and weight usual custom before day-break which business is more likely to borrow from an investment bank