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
diamong [38]
4 years ago
10

Write a program to generate all combinations of 1, 2 and 3 usingfor loop.

Computers and Technology
1 answer:
Citrus2011 [14]4 years ago
4 0

<u>C program for generating all combinations of 1, 2 and 3 </u>

#include<stdio.h>

int comb(int a,int b,int c)/*defining function with parameters a,b and c of int type*/

{

for (a=1; a<4; a++)   //loop for the first integer

   {

   for (b=1;b<4; b++) //loop for the second integer        

        {

          for (c=1; c<4; c++) //loop for the third integer                

               printf("One of the combination is \n%d %d %d", a, b, c);

         }

   }

return 0;

}

int main()//driver function

{

int a, b, c;

printf("Combinations are-");

comb(a,b,c);//calling function

return 0;

}

<u>Output</u>

Combinations are-

One of the combination is 1 1 1

One of the combination is 1 1 2

One of the combination is 1 1 3

One of the combination is 1 2 1

One of the combination is 1 2 2

One of the combination is 1 2 3

One of the combination is 1 3 1

One of the combination is 1 3 2

One of the combination is 1 3 3

One of the combination is 2 1 1

One of the combination is 2 1 2

One of the combination is 2 1 3

One of the combination is 2 2 1

One of the combination is 2 2 2

One of the combination is 2 2 3

One of the combination is 2 3 1

One of the combination is 2 3 2

One of the combination is 2 3 3

One of the combination is 3 1 1

One of the combination is 3 1 2

One of the combination is 3 1 3

One of the combination is 3 2 1

One of the combination is 3 2 2

One of the combination is 3 2 3

One of the combination is 3 3 1

One of the combination is 3 3 2

One of the combination is 3 3 3

You might be interested in
Your program is going to compare the distinct salaries of two individuals for the last 5 years. If the salary for the two indivi
kirza4 [7]

In python:

i = 1

lst1 = ([])

lst2 = ([])

while i <= 5:

   person1 = int(input("Enter the salary individual 1 got in year {}".format(i)))

   person2 = int(input("Enter the salary individual 1 got in year {}".format(i)))

   lst1.append(person1)

   lst2.append(person2)

   i += 1

if sum(lst1) > sum(lst2):

   print("Individual 1 has the highest salary")

else:

   print("Individual 2 has the highest salary")

This works correctly if the two individuals do not end up with the same salary overall.

4 0
3 years ago
Catering question<br> What is the hottest food in the world
Elza [17]
The hottest food in the world is a Ghost Pepper. It is 400 times hotter than Tabasco sauce. It was 1 million SHU's! Hope this helps! ^0^

The correct answer is: Ghost Peppers
7 0
4 years ago
A mail merge data source must contain
Katena32 [7]

Answer:

A. a collection of organized data.

Explanation:

It can be a data source, or a database, an excel sheet. or access database. However, it must be well-formatted and hence organized. filtering of data is not necessary, as well as it is not any barrier to the number of the set of data, or the data being sorted. Unsorted data is also fine, and multiple set of data is also fine. It must be known that a data source can be formed from multiple sets of data through the query. And the resultant data source can be used by the mail merge. However, the data source must be a collection of organized data. Hence, A is the correct answer.

5 0
4 years ago
Which of these is not a way of avoiding email fraud and scams?
Sever21 [200]

Answer:

"If you aren't sure if a link is legitimate, click it to see where it goes."

Explanation:

If you click on a unknown URL the host of the website can steal a lot of information from you computer. Like your geolocation  

7 0
3 years ago
help:(What are the uses of various lights? How are they all different? How do you decide on their usage? How can you use natural
Monica [59]

Answer:

This is one of the most common types of lighting. Ambient light is a soft glow that blankets your space just enough for you to function without causing a harsh glare. In photography and cinematography, ambient light is considered the "natural light" within a room. In décor, ambient light is very similar, except you create the ambient light by making the room's lighting as natural and flat as possible. While ambient light is meant to get you safely from point A-to-B, it is not ideal for working closely with things or to highlight things around your space. When used correctly, ambient light creates a fantastic environment to relax from an overly stressful day or to have a warm conversation with an old friend. Ambient lighting is often referred to as mood lighting, because this light captures the soft curves of your face and allows your pupils to dilate slightly (a physical sign of affection). Some yoga studios have even begun using the softer ambient lighting in their classes to help draw stress from the body. This is a smaller more concentrated light. You want task lighting around when you’re working. In fact, some people call it office lighting. Task lighting is meant to help you see when you’re doing projects in which you need a finer light, such as, reading, cooking, writing, sewing and many other things. Task lighting only works well when it is used as a contrasting light. For example, if you have a low lit room with a swing arm lamp turned on over your desk, the light over the desk surface will be more effective with less glare or shadow-effect than if the entire room was lit with a brighter light. Task lighting helps naturally stimulate your brain. The contrasting light allows you to be more alert and concentrated. This will help you see more details as you work, creating higher quality results. This is why many businesses choose to use task lighting in their offices.

Explanation:

5 0
3 years ago
Other questions:
  • select three types of school which specifically emphasize learning through creativity, self expression, and play
    10·2 answers
  • The IBM nine-track tapes that became the industry standard for storage for three decades had several sizes , the most common bei
    13·1 answer
  • How to make a harmonic mean algorithm in bash Linux?
    15·1 answer
  • Using the Insert tab, you can convert text into a table and a table into text.
    15·1 answer
  • What is a file path?
    7·1 answer
  • Davingould1115...................answer 3​
    11·1 answer
  • Think of some local businesses that have websites. Look online and identify two different websites for businesses or services in
    14·1 answer
  • What problems do you see in the process of transacting business online
    10·1 answer
  • Which of the following statements describe the benefits of a career in transportation, distribution, and logistics (TDL)?
    5·1 answer
  • A Chain of dry-cleaning outlets wants to improve its operations by using data from devices at individual locations to make real-
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!