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
blondinia [14]
4 years ago
6

9.4 Code Practice:Question 1

Computers and Technology
1 answer:
Ymorist [56]4 years ago
4 0

Answer:

// Program is written in C++

// Comments are used for explanatory purpose

// Program starts here

#include<iostream>

using namespace std;

int main()

{

// Declare array

/* There are 18 characters between f and w. So, the array is declared as thus;*/

char letters [18];

// Initialise array index to 0

int i = 0;

// Get input

for(char alphs = 'f'; alphs<='w'; alphs++)

{

letters[i] = alphs;

// Increment array elements

i++;

}

// Print Array

cout<<"['";

for(int j = 0; j <18; j++)

{

if(j<17){

cout<<letters[j]<<"', '";

}

else

{

cout<<letters[j]<<"']";

}

}

return 0;

}

Explanation:

The above code declares a char array named letters of length 18. This is so because there are 18 characters from f to w (both inclusive). This is done using the following: char letters [18];

Index of array starts from 0; so, the next line initializes the array letters to 0 and prepares it for input.

The first for-loop statement is used to input characters to letter array. This done by iterating from 'f' to 'w' using variable alphs.

Outside the for loop; the statement cout<<"['"; prints ['

The next for loop prints f','g','h' ........ 'w']

Bring this two prints together, it gives the desired output

['f','g','h' ........ 'w']

You might be interested in
How do you change colors for presentation to blue warm in power point?
Furkat [3]

In PowerPoint presentations you can change background color. The best way to do this is to change the template background color in the master view. This will let you use the same background color among the whole presentation and also for the new slides that you will create.

In order to change the background color in Microsoft PowerPoint 2010 we need to go to View and Slide Master. Then, right click on the first slide and click Format Background.

5 0
3 years ago
Isla is writing a report on the best roller coasters in America. Which device could help her with this?
Ulleksa [173]

Answer: a device that can help could be a map.. she could learn about that place then see if its coasters are better.

Explanation: i dunno if i'm right

~shina~

4 0
3 years ago
What happens when you send a fax to a phone?
DiKsa [7]
The message is received?
4 0
4 years ago
Double click on a sheet tab to ______ the sheer
Anni [7]

its delete cuz i just tryed it now and i think im right if im wrong forgive me


8 0
3 years ago
Read 2 more answers
Using Python, Write a function whose input is which term of the fibonacci sequence the user would like toknow, and whose output i
Alika [10]

Answer:

#here is code in python

#recursive function to find nth Fibonacci term

def nth_fib_term(n):

#if input term is less than 0

if n<0:

 print("wronng input")

# First Fibonacci term is 0

elif n==0:

 return 0

# Second Fibonacci term is 1

elif n==1:

 return 1

else:

#find the nth term of Fibonacci sequence

 return nth_fib_term(n-1)+nth_fib_term(n-2)

n=int(input("please enter the term:"))

print(n,"th Fibonacci term is: ")

print(nth_fib_term(n))

Explanation;

Read the term "n" which user wants to know of Fibonacci sequence.If term term "n" is less than 0 then it will print "wrong input". Otherwise it will calculate nth  term of Fibonacci sequence recursively.After that function nth_fib_term(n) will return  the term. Print that term

Output:

please enter the term:7

7 th Fibonacci term is:

13

4 0
3 years ago
Other questions:
  • Enter the name of your school or work URL and generate report.What score did it receive?
    9·1 answer
  • What is the device that allows users to manipulate data by controlling an onscreen pointer
    5·2 answers
  • Which of the following protocols is used to unsure secure transmissions on port 443?A. HTTPSB. TelnetC. SFTPD. SHTTP
    6·1 answer
  • Use a logical OR to write a more concise equivalent of the following code:
    11·1 answer
  • In preparing his persuasive presentation, Reza should most likely focus on clearly presenting his
    6·2 answers
  • A network administrator manages a network with 75 servers. At least twenty of those servers are approaching end of life but the
    8·1 answer
  • Question 1<br> REVPAR and REVPOR are basically the same thing.<br> True<br> False
    11·1 answer
  • Write a complete method to create an array of random integers. The method takes in three integer parameters: the array size, the
    9·1 answer
  • List different examples of models​
    5·1 answer
  • 1) What is y after executing the statements?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!