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
kipiarov [429]
3 years ago
5

Write the following C function and main function;

Computers and Technology
1 answer:
Rina8888 [55]3 years ago
8 0

Answer:

The program to this question can be given as:

Program:

#include <stdio.h> //include header files.

#include <limits.h>

//declaration of function

void find_three_smallest(int a[], int n, int *small, int *second_smallest, int *third_smallest);

//definitation of function

void find_three_smallest(int a[], int n, int *smallest, int *second_smallest, int *third_smallest)

{//function body.

int i, first_number, second_number, third_number;       //define variable.

// There should atleast be three values

if (n < 3)       //check condition.

{

printf(" Invalid Input ");      //print message.

return;

}

first_number = second_number = third_number = INT_MAX;

for (i = 0; i < n ; i ++)    //Using loop  

{

//conditional statements.

// If current element is smaller than first then update all

if (a[i] < first_number)            

{

third_number = second_number;

second_number = first_number;

first_number = a[i];

}

else if (a[i] < second_number )

{

third_number = second_number;

second_number = a[i];

}

else if (a[i] < third_number )

{

third_number = a[i];

}

}

//print values.

printf("The smallest value =%i\n",first_number);

printf("Second_smallest value =%i\n",second_number);

printf("Third_smallest value =%i\n",third_number);    

}

//main method

int main()

{

int num, small, second_small, third_small; //define variable.

int x[6] = {1,3,4,5,1,2};         //define 1-D array.

num = sizeof(x)/sizeof(x[0]);  

find_three_smallest(x,num ,&small, &second_small, &third_small);       //calling function.

return 0;

}

Output:

The smallest value = 1

Second_smallest value = 1

Third_smallest value = 2

Explanation:

In the above C language program firstly we declare a function that's name is already given in the question.  

In this function we define the variable that takes all value from the main function and checks that the given values(numbers) are greater then 3. if the value is greater then 3 functions arranged values and finds the smallest, second smallest and third smallest value and print it. In the main function, we define a 1_D array. In that array, we assign the value and pass the value to the function. In the next line, we calling the function.  

You might be interested in
Does clearing your hard drive make your computer faster reddit
kondaur [170]
Well I suppose it would depend on what you have on your hard drive. If you have background applications that are using the computers memory without your knowledge, a clear drive would result in your performance improving. So I would say in general, clearing your drives would indeed make your computer faster. 
4 0
3 years ago
What is the task included in the information systems manager?​
kobusy [5.1K]

Answer:

research and install new systems and networks. implement technology, directing the work of systems and business analysts, developers, support specialists and other computer-related workers. evaluate user needs and system functionality, ensuring that IT facilities meet these needs.

Explanation:

5 0
3 years ago
A third party intercepting a packet and downloading its information before it is sent onward toward its destination is called
SSSSS [86.1K]

Answer:

Explanation:

<u>Packet sniffing</u> is the process of capturing each packet that is transmitted over the network and analyzing its content. Most of the time, packet sniffing is used to troubleshoot network problems or to gather network statistics. The software or device used for capturing packet data is called packet sniffer, packet analyzer, network sniffer or simply network analyzer.

The Packet Sniffer Sensor monitors, among other things:

• Total traffic

• Port sniffer

• Web traffic (HTTP, HTTPS)

• Mail traffic (IMAP, POP3, SMTP)

• File transfer traffic (FTP, P2P)

• Infrastructure traffic (DHCP, DNS, ICMP, SNMP)

• Remote control (RDP, SSH, VNC)

• Other UDP and TCP traffic

Third party intercepting a packet and downloading it information before it is sent onward toward its destination is called <u>Packet Sniffer</u>

4 0
3 years ago
In Microsoft Word you can access the _______ command from the "Mini toolbar".
xenn [34]
I think the answer is save as
4 0
4 years ago
Atomic Term If an atom carries no charge, the positive charges from protons are balanced by the negative charges from the
Neko [114]

Answer:

yee ha

Explanation:

7 0
3 years ago
Other questions:
  • Information Can Be Gathered Regarding The Temperature Of A Substance And Uploaded To A Computer Using A ___________ As A Data Co
    6·1 answer
  • An airline company would like to easily locate lost luggage. What technology would make it easier for them to locate the luggage
    6·2 answers
  • Where do you go to create a workbook?​
    8·1 answer
  • In csma/ca, the amount of time a device is made to wait before it can transmit is called the ____.
    15·1 answer
  • Carbon monoxide poisoning can result from breathing
    15·1 answer
  • ____ is a consistent relational database state in which every foreign key value also exists as a primary key value.​ a. ​ Refere
    11·1 answer
  • Your friend gave you a flash drive containing photos from a weekend event. After you copy the files, you notice a bunch of .DS f
    6·1 answer
  • Work-based learning can be defined as educational experiences that focus on
    11·1 answer
  • How could you use your technology skill and Microsoft Excel to organize, analyze, and compare data to decide if a specific insur
    12·1 answer
  • PI
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!