Basic Problems
Basic Problems
1. Simple Interest Calculation: Write a program that uses a function to calculate and
return simple interest with given principal, rate, and time.
2. Temperature Conversion: Write a program that uses two functions to convert
temperature from Celsius to Fahrenheit and vice versa, respectively and return the
converted values.
3. Sum of Natural Numbers: Given a positive integer n, write a program to calculate
and return the sum of natural numbers up to n using loops.
4. Check Even or Odd Number: Write a program that takes n as user input and
determines if it is even or odd.
5. Calculate Factorial using Loops: Write a program to calculate the factorial of a
number using for loop and return its value.
6. Basic Array Operations: Write a program to traverse an array and print the odd-
indexed elements.
7. Find Largest Element in an Array: Write a program that uses for loops to find the
largest element in a 1-D array and returns it.
8. Sum of Array Elements: Write a program to calculate and return the sum of
elements of a 1-D array.
9. Array operations: Write a program to find average, max and min elements from an
array of n long integers.
10. Swap Two Numbers: Write a program that uses two functions to swap two numbers
a. Using a third variable b. Without using a third variable
1. Matrix Addition: Write a program to perform addition of two 2-D arrays (matrices).
2. Matrix Multiplication: Write a program to perform multiplication of two 2-D arrays.
3. String Reverse without Library Function: Write a program to reverse a string
(array of char) without using string library functions.
4. String Handling using Library Functions: a. Palindrome Check for a String: Write a
program to check if a string is a palindrome or not. b. String Length Calculation Using
Functions: Write a program to calculate the length of a string using a library
functions / predefined operators. c. String Concatenation: Write a program to
concatenate two strings using library functions.
5. Compute nCr using Functions: Write a function to calculate nCr, where n and r are
given by the user.
6. Recursive Function for Fibonacci Series: Write a program to generate the
Fibonacci series up to n terms using recursion.
7. File Handling Operations: a. File Write Operation: Write a program to write data into
a file. b. File Read Operation: Write a program to read data from a file. c. File Append
Operation: Write a program to append data to a file.
8. Multi-level Menu using Switch Case: Write a program to create a multi-level menu
using switch cases that perform various basic mathematical operations (Add,
Subtract, Divide, Multiply, Exponent).
9. Linear Search in Array: Write a program to implement linear search in a 1-D array.
10. Swap Two Numbers Using Pointers: Write a program to swap values of two
variables using pointers.
11. Pointer Arithmetic: Write a program to illustrate the following basic pointer arithmetic
operations. a. Increment a pointer b. Decrement a Pointer c. Add an integer to a
pointer d. Subtract an integer from a pointer e. Subtract two pointers of the same type
12. Recursive Function for Factorial: Write a program to calculate the factorial of a
number using recursion.
13. Call by Reference Using Pointers: Write a program to demonstrate call by
reference using pointers in functions.
14. Dynamic Memory Allocation for 1-D Array: Write a program to allocate memory
dynamically for a 1-D array using malloc.
15. Sum of Diagonal Elements in a Matrix: Write a program to calculate the sum of
diagonal elements of a 2-D square matrix using a function.
• Implement functions to add, display, and search for employees in the array.
• Return the transposed array to the main function and display it.
• Allow the user to choose an operation and invoke it using the function pointer.
• Concatenate in order to form the largest possible number and print it.
Would you like full code implementations for any of these programs?