10)adding numbers
Victor has an array of size n.He loves to play with these n numbers.each time he plays with them ,he picks up any two consecutive numbers and adds them. on adding both numbers,it costs him K*(sum of both numbers).
Find the minimum cost of adding all the numbers in the array.
i/p1:size of array
i/p2:elements of array
i/p3:value of K
o/p:return the maximum cost of adding all the numbers of the array.
Ex1:
i/p1:3
i/p2:{1,2,3}
i/p3:2
o/p:18
explanation: There are multiple ways of adding the numbers of an array.
The first way is:1+2=3 cost of adding is 2*3=6.
3+3=6 cost ofadding is 2*6=12
o/p: there are other ways as well,but minimum cost is 18
ex2:
i/p1:4
i/p2:{4,5,6,7}
i/p3:3
o/p:132
explanation:
for minimum cost ,
4+5=9 cost of adding is 3*9=27
6+7=13 cost of adding is 3*13=39
9+13=cost of adding is 3*22=66
Therefore cost is 27+39+66=132
Implement the following functions. The functions return a real number:
(a) Function Celsius returns the Celsius equivalent of a Fahrenheit temperature ((32°F − 32) ×
5/9 = 0°C).
(b) Function Fahrenheit returns the Fahrenheit equivalent of a Celsius temperature.
((0°C × 9/5) + 32 = 32°F)
In main call both functions and ask user to input value of temperature and print its equivalent.
Get the input from the user for the number of rows and columns.
Print 0 in the row one.
Print 1 in the row two.
Case= Test 1
input=
5
5
output=
00000
11111
00000
11111
00000
Write a C program in CodeBlocks to find the largest among three different numbers entered by the user using Nested if else Statement and also construct a flow chart for this program
Write a program to take input your name. Now write a function to print your name
in reverse order (eg. RAM KUMAR becomes RAMUK MAR). Then Write one more
function to find sum of ASCII values of all the characters (including space) in your
name using function.
A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two dimensional 3 × 7 array, where each row represents a different monkey and each column represents a different day of the week. The program should first have the user input the data for each monkey. Then it should create a report that includes the following information: I. Average amount of food eaten per day by the whole family of monkeys. II. The least amount of food eaten during the week by any one monkey. III. The greatest amount of food eaten during the week by any one monkey. Input Validation: Do not accept negative numbers for pounds of food eaten.
Write a program that will predict the size of a population of red ants. The program should ask the user for the starting number of red ants e.g. 2,000,000, their average daily population increase as a percentage of current population e.g., 5%, and the number of days they will multiply e.g. 10 days. Use a do while to display the size of the population for each day. Draw a flow chart and write down a pseudo code before attempting this number. Input Validation: Do not accept a number less than two for the starting size of the population. Do not accept a negative number for average daily population increase. Do not accept a number less than one for the number of days they will multiply.
you are given a 3x3 matrix of positive integers.You have to determine whether some row is a positive interger multiple of another. If row i is an interger multiple of row j then you have to output p#q where p is the minimum of (i,j) and q is the maximum of (i,j). If there are multiple possibilities for i and j, you have to print for smallest i and the smallest j. Otherwise, you have to output 0#0
Write a C program to sort the digits of an integer in ascending and descending order using pointers.
Note:
Enter an integer
print the integer in ascending and descending order
For example:
Test Input Result
1 54387 34578
87543