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
kvasek [131]
3 years ago
10

Write a program that prints the following 45 pairs of numbers:

Computers and Technology
1 answer:
nadezda [96]3 years ago
8 0

Here is code in C++ to print the following 45 pairs of numbers:

11 21 22 31 32 33 41 42 43 44 51 ...

// include header

#include <bits/stdc++.h>

using namespace std;

//main function

int main() {

//declare variables

int count=0;

int flag=1;

// for loop to print the pattern

for(int i=1;;i++)

{

for(int j=1;j<=i;j++)

  {

// this will print the pairs in vertical manner

     cout<<i<<j<<endl;

//cout<<i<<j<<""; //this will print horizontally

// this will keep count to print only 45 pairs

count++;

// if count is equal to 45 then it will break the inner loop

     if(count==45)

     {

         flag=0;

         break;

     }

}

   // if the flag is eqaul to 45 then it will break the outer loop

   if(flag==0)

     break;

}

return 0;

}

Explanation:

First declare and initialize two variables "count=0" & "flag=1". Here variable

"count" is use to print only 45 pairs and "flag" is used to break the loop when 45 pairs of numbers are printed.In the nested for loop, for every value of i,j will run from 1 to i and print i then j without any space. After every pair, count will incremented by 1. It will check if "count" is greater than 45 or not. If "count" is greater than 45 then it make flag=0 and break the loop. in the outer for loop, if flag is 0 then it break the outer for loop.

Output:

11 21 22 31 32 33 41 42 43 44 51 52 53 54 55 61 62 63 64 65 66 71 72 73 74 75 76 77 81 82 83 84 85 86 87 88 91 92 93 94 95 96 97 98 99

You might be interested in
Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Els
kherson [118]

Answer:

// here is code in c.

#include <stdio.h>

// main function

int main()

{

// variable to store year

int year;

printf("enter year:");

// read the year

scanf("%d",&year);

// if year>=2101

if(year>=2101)

{

printf("Distant future");

}

//if year in 2001-2100

else if(year>=2001&&year<=2100)

{

   printf("21st century");

}

//if year in 19011-2000

else if(year>=1901&&year<=2000)

{

  printf("20th century");

}

// if year<=1900

else if(year<=1900)

{

  printf("Long ago");  

}

return 0;

}

Explanation:

Read the year from user.After this, check if year is greater or equal to 2101 then print "Distant future".If year is in between 2001-2100 then print "21st century".If year is in between 1901-2000 then print "20th century".Else if year is less or equal to 1900 then print "Long ago".

Output:

enter year:2018                                                                                                            

21st century

7 0
3 years ago
Read 2 more answers
To begin importing data from an excel spreadsheet, click on the ____ tab on the ribbon.
Mamont248 [21]

Answer:

External data

Explanation:

The "external data" is one of the tabs on the ribbon. It is used for importing data from an excel spreadsheet.

Hope this helps!

3 0
3 years ago
A person you respect who offers you advice and assistance is known as a(n) _____.
Archy [21]
This would be a mentor-D. They role is to mentor or guide you with advice or assistance. A role model is a similar answer in that they respect you, but they might not offer advice or assistance which makes it incorrect.
7 0
3 years ago
When you think of computers, I want you to think:
jekas [21]

Answer:

Explanation:

When I think about computers, I can understand about the software and the hardware, we can touch the hardware, but the software don't because is only data stored in the hardware, we can interact with the stored data using the hardware, we can complete a system with data, software, hardware, and people, people try to learn about software because it is better paid than fix a hardware.

5 0
3 years ago
(viii) Word does not allow you to customize margins. <br>true/false:-​
Tatiana [17]
In Word, each page automatically has a one-inch margin. You can customize or choose predefined margin settings, set margins for facing pages, allow extra margin space to allow for document binding, and change how margins are measured.

I would say false
6 0
3 years ago
Other questions:
  • When a machine on the public network wants to reach the server at 172.30.0.10, which ip will it use?
    6·2 answers
  • Let PALINDROME_DFA= | M is a DFA, and for all s ∈ L(M), s is a palindrome}. Show that PALINDROME_DFA ∈ P by providing an algorit
    5·1 answer
  • A(n) ____ web site structure connects web pages in a treelike structure.
    6·1 answer
  • Computer science
    6·1 answer
  • To what does the term computer hacking refer?
    10·2 answers
  • THE PROTOCOL ORIGNALLY RAN ON TOP OF NETBT,BUT today runs by itself and uses port 445?
    11·1 answer
  • Discuss your views on multiple backgrounds. What are the advantages and disadvantages of having multiple backgrounds? Your submi
    8·1 answer
  • Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in
    9·1 answer
  • To connect several computers together, one generally needs to be running a(n) ____ operating system
    12·1 answer
  • A External hackers have some access to a company's website and made some changes. Customers have submitted multiple complaints v
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!