The document contains 10 questions asking to write programs that use functions to perform calculations on things like interest, temperature conversion, sums, factorials, arrays, and number properties. The programs are asked to return calculated values. Functions are used to calculate simple interest, convert between Celsius and Fahrenheit, find the largest element in an array, and swap two numbers with and without a third variable. Loops are used to calculate sums, factorials, and print odd indexed array elements.
The document contains 10 questions asking to write programs that use functions to perform calculations on things like interest, temperature conversion, sums, factorials, arrays, and number properties. The programs are asked to return calculated values. Functions are used to calculate simple interest, convert between Celsius and Fahrenheit, find the largest element in an array, and swap two numbers with and without a third variable. Loops are used to calculate sums, factorials, and print odd indexed array elements.
The document contains 10 questions asking to write programs that use functions to perform calculations on things like interest, temperature conversion, sums, factorials, arrays, and number properties. The programs are asked to return calculated values. Functions are used to calculate simple interest, convert between Celsius and Fahrenheit, find the largest element in an array, and swap two numbers with and without a third variable. Loops are used to calculate sums, factorials, and print odd indexed array elements.
1) Write a program that uses a function to calculate and return
simple interest with given principal, rate, and time. Q NO. 2) Write a program that uses two functions to convert temperature from Celsius to Fahrenheit and vice versa, respectively and return the converted values. Q NO.3) Given a positive integer n, write a program to calculate and return the sum of natural numbers up to n using loops. QNO.4) Write a program that takes n as user input and determines if it is even or odd. ` Q NO. 5) Write a program to calculate the factorial of a number using a for loop and return its value. Q NO. 6) Write a program to traverse an array and print the odd- indexed elements. Q NO. 7) Write a program that uses for loops to find the largest element in a 1-D array and returns it. Q NO.8) Write a program to calculate and return the sum of elements of a 1-D array. Q NO.9) Write a program to find average, max and min elements from an array of n long integers. Q NO.10) Write a program that uses two functions to swap two numbers (A) Using a third variable (B) Using a third variable