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
yulyashka [42]
2 years ago
5

Write a program that prints the numbers 1 to 4 on the sameline with each pair of adjacent numbers separated by a single space(1

2 3 4). Print the numbers in the followingthree ways:
(a) Using one output statement with one streaminsertion operator.
(b) Using one output statement with four streaminsertion operators.
(c) Using four output statements.
Computers and Technology
1 answer:
kondaur [170]2 years ago
7 0

Answer:

#include <iostream>

using namespace std;

int main() {

   cout<<"Printing by method 1"<<endl;

   //using 1 output statement with one streaminsertion operator.

   cout<<"1 2 3 4";

   cout<<endl<<"Printing by method 2"<<endl;

   //using 1 output statement with four stream insertion operator.

   cout<<"1 "<<"2 "<<"3 "<<"4";

   cout<<endl<<"Printing by method 3"<<endl;

   //using four output statements.

   cout<<"1 ";

   cout<<"2 ";

   cout<<"3 ";

   cout<<"4 ";

return 0;

}

Output:-

Printing by method 1

1 2 3 4

Printing by method 2

1 2 3 4

Printing by method 3

1 2 3 4

Explanation:

The above code is as per the question given.All the three methods are implemented as per the question.

You might be interested in
Write a function named initialMatch that takes a string parameter, text, that contains only lowercase letters and whitespace. Th
Furkat [3]

Answer:

Implementing on Python for the question, the following is the code.

Explanation:

def intialMatch(l):

   word_dict={}

   for word in l.split():

       if word_dict.get(word)==None:

           word_dict[word]=[]

       for key in word_dict.keys():

           if key[0]==word[0] and (word is not key) :

               values = word_dict.get(key)

               if word not in values:

                   values.append(word)

       for key,values in word_dict.items():

           for value in values:

               if value==key:values.remove(value)

   return word_dict

t='do what you can with what you have'

print(intialMatch(t))

6 0
3 years ago
Which statement is false? Select one: a. A class is to an object as a blueprint is to a house. b. Classes are reusable software
kow [346]

Answer:

A class is an instance of its object

Explanation:

6 0
2 years ago
Rocks created from compaction and cementation of sediments are called:
Effectus [21]

Answer:

Sedimentary Rocks

Explanation:

Sedimentary rocks are essentially the Frankenstein monsters of the rock world. They're made up of pieces of igneous and metamorphic rocks, sand, clay, and other sedimentary rocks.

4 0
2 years ago
Using Turtle Graphics, write a program that will produce 2 Zs next to each other. It is irrelevant where these Zs appear and wha
LekaFEV [45]

Answer:

# import the  turtle library

from turtle import *

# create a turtle space

space = Screen()

# create a turtle object

z = Turtle()

 

# create a single Z

z.forward(50)

z.right(120)

z.forward(100)

z.left(120)

z.forward(50)

 

# adjust the turtle position

z.up()

z.left...

Explanation:

8 0
3 years ago
Multiple Choice
zalisa [80]
Zeros and ones
Hope the helps
Godspeed
7 0
2 years ago
Other questions:
  • What can I do if my mouse on my laptop keeps freezing on me for 5 minutes
    11·1 answer
  • True or false? A medical assistant can check for available exam rooms and providers using an electronic scheduling system.
    8·1 answer
  • What includes two or more private, public, or community clouds, but each cloud remains separate and is only linked by technology
    7·1 answer
  • Why is compression a "hard problem" for computers? Draw on your own experience compressing text with the text compression widget
    12·1 answer
  • Write a method called sum with a while loop that adds up all numbers between two numbers a and b. The values for a and b can be
    11·2 answers
  • Translate the following C program into an assembly program. The C program finds the minimal value of three signed integers. Assu
    13·1 answer
  • I made a mistake. I'm building my first PC and I bought a Ryzen 7 3800x and planning on getting a 2070 super (if I can). What I
    9·1 answer
  • You are now going to prepare some reports for the company. Measurements are in metres and volume
    7·1 answer
  • What are the main security weaknesses of coaxial cable, twisted pair cable, and fiber optic cable? How might the router itself b
    8·1 answer
  • What is the difference between a computer’s RAM and its hard disk?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!