Write a C function called min which takes 2 integers as input, and returns the smallest as the result?
Solution:
#include <stdio.h>
int min(int a, int b)
{
if(a<b)
return a;
else
return b;
}
int main(void) {
int a,b;
printf("Enter first integer:");
scanf("%d",&a);
printf("Enter second integer:");
scanf("%d",&b);
printf("Minimum integer is: %d",min(a,b));
return 0;
}
output:
Enter first integer:6
Enter second integer:8
Minimum integer is: 6
please give thumbs up or do comment in case of any query. Thanks.
Write a C function called min which takes 2 integers as input, and returns the smallest...
C++, Create a function called larger which takes two integers as its parameters and returns the larger of the two integers
In C++ write an application which takes positive or negative integers and returns the sum of each place in the number, such that 246 results in 12 and -88 results in -16. The program is called and runs with no prompt for input. The program reads exactly one signed integer from standard input. The program displays the sum of each digit of the number as a signed integer. This should be done in two files called main.cc and makefile.The result...
Write a Java method called compare that takes two integers as input parameters and returns 1 if the first parameter is larger than the second parameter returns – 1 if the second parameter is larger than the first parameter, and returns 0 if the two parameters are equal.
2. write a SQL procedure called min max that takes department name as input and returns maximum and minimum salary of the department. Test your procedure running following queries: set @dept-"History". # @dept is a MariaDB local variable CALL min_max(@dept,@minv,@maxv) select @dept as department,@minv as minsalary, @maxv as maxsalary:
C++ Write a function that takes as an input parameter a matrix of integers, and 2 integers representing the matrix’s dimensions. Print out the transposed version of the matrix. Input: [[1 2 3] 3,3 ->1 4 7 [4 5 6] 2 5 8 [7 8 9]] 3 6 9
Write a function that returns the index of the smallest element in an array of integers. If there are more such elements than one, return the smallest index. C programming
java code
Write a method called reverse that takes an array of integers as an input and returns the same values in reverse order as the output. Test your method in the main.
Write a function findEvens that takes an integer, n, as input and returns the list of even integers between 1 and n. Ex. Input: 10 Output: [2,4,6,8,10] Write a function sortList that takes in a list of strings and returns a list of those strings now sorted and lowercase. Ex. Input: [‘ABE’,’CAD’,’gaB’] Output: [‘abe’,’acd’,’abg’] Both done in Python
Code in C++ please! Write a function that takes an array of integers as an input parameter (the address of the first value of the array). It returns nothing. It prints out the array as a single line, with commas between each number, and when the array is finished being printed, it prints an endl; so that we flush the buffer and move to a new line. (I’m having you write this function because you’ll be wanting to print out...
python Write a function called has_odd_even that takes three integers as parameters and that returns True if there is at least one odd and at least one even among the three numbers and that returns False otherwise. Below are some sample calls and the appropriate value to return. Function call Value returned has_odd_even(2, 4, 6) False has_odd_even(2, 3, 4) True has_odd_even(12, 4, 17) True has_odd_even(5, 17, 4) True has_odd_even(14, 7, 5) True has_odd_even(5, 4, 2) True has_odd_even(13, 20, 91) True...