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:
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
1 write a Python function that takes in a list of integers and returns maximum and minimum values in the list as a tuple. Hint (can be done in one pass, you are not allowed to use built-on min and max functions.)max, min = find_max_min(my_list):2 write a Python function that takes in a list of integers (elements), and an integer number (num). The functions should count and return number of integers in elements greater than, less than, and equal to...
Write a function in the C++called summary that takes as its parameters an input and output file. The function should read two integers find the sum of even numbers, the sum of odd numbers, and the cumulative product between two values lower and upper. The function should return the sum of even, odd, ad cumulative product between the lower and upper values. Please write program in C++.
Write a function called productEven that takes as its parameter an input file. The function should read two integers and calculate the total product of only even numbers between them. Return the answer to the calling function. c++ program