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
Elanso [62]
4 years ago
9

Write a function to output an array of ints on a single line. Funtion Should take an array and an array length and return a void

. It should look like this {5,10,8,9,1}
Computers and Technology
1 answer:
nikitadnepr [17]4 years ago
5 0

Answer:

void printarr(int nums[],int n)

{

   cout<<"{";//printing { before the elements.

   for(int i=0;i<n;i++) // iterating over the array.

   {

       cout<<nums[i];//printing the elements.

       if(i==n-1)//if last element then come out of the loop.

       break;

       cout<<",";//printing the comma.

   }

   cout<<"}"<<endl;//printing } at the end.

}

Output:-

5

1 2 3 4 5

{1,2,3,4,5}

Explanation:

I have created a function printarr of type void which prints the array elements in one line.I have used for loop to iterate over the array elements.Everything else is mentioned in the comments.

You might be interested in
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMile
Ann [662]

Answer:

See Explanation

Explanation:

Your program is correct and doesn't need an attachment.

However, there's a mismatch in placement of curly braces in your program

{

}

I've made corrections to that and I've added the corrected program as an attachment.

Aside that, there's no other thing to be corrected in your program.

Use another compiler to compile your program is you are not getting the required output.

Download java
7 0
3 years ago
(I need help also can u guys just give me some example just in case I got confuse)
Vesna [10]

Answer:

1) there should be boundaries because you never know what could happen on the internet as people tend to not have control of who is on theyre account or texting them,

2) if you have a phone you should be responsible and not do something that could get you in alot of trouble ,

3) it's important because if somebody else gets your information things can be sent that you didnt send ,that can get you in legal trouble or start a fued between people,

5) comments only matter if you let them matter as people's opinions shouldn't matter to you as long as your happy,

6) block, report , and notify a trusted adult.

8 0
3 years ago
Please code in python and add comments to code
Gnoma [55]

#accepting input from user

n=int(input("Enter a number: "))

#entered number is stored in a temporary variable

temp=n

#initializng required variables

rev=0

dgt=0

#digits are reversed inside while loop

while(n>0):

dgt=n%10

rev=rev*10+dgt

n=n//10

#original number and its reverse are compared

if(temp==rev):

#if equal, it's a palindrome

print("It is a Palindrome")

else:

#if not equal, it's not a palindrome

print("It is not a Palindrome")

#◌⑅⃝●♡⋆♡Nåmřāthā♡⋆♡●⑅◌

4 0
3 years ago
What can I do with R?
mote1985 [20]
What are u asking???????
5 0
3 years ago
Which option offers predesigned formatting and design elements for creating a document?
saveliy_v [14]

Answer:

I would say templates. Template comes with predefined page layout, fonts, margins, and styles. We can have certain layouts, headings, fonts for specific topic.

3 0
3 years ago
Other questions:
  • Most students overestimate their skill level and abilities to take open book tests.
    11·2 answers
  • What is this file used for
    15·2 answers
  • Hypertext Markup language (HTML) version _____ added support for style sheets to give web designers greater control over page la
    12·1 answer
  • Boardman College maintains two files—one for Sociology majors and another for Anthropology majors. Each file contains students'
    5·1 answer
  • Which shape denotes a process to be carried out in a flowchart?
    7·2 answers
  • Which statement about bump mapping and normal mapping is true?
    9·1 answer
  • In Python please.
    13·1 answer
  • What is the bit pattern (raw binary) of the single precision representation of the decimal number 0.125 following IEEE 754 stand
    9·1 answer
  • Please help!! i need this asap &lt;3 <br> (the boxes have the same answer choices in both)
    7·2 answers
  • Jacob was sitting in class. His teacher understands that he is the type of student that doesn't comprehend when he sees or hears
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!