0% found this document useful (0 votes)
19 views3 pages

Basic Problems

Uploaded by

d4dcrvspbc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views3 pages

Basic Problems

Uploaded by

d4dcrvspbc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Basic Problems (10 Programs)

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

Intermediate Problems (15 Programs)

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.

Advanced Problems (10 Programs) in Points

1. Array of Structures for Employee Database

• Define a structure for an employee (e.g., name, id, salary).

• Use an array to store multiple employee records.

• Implement functions to add, display, and search for employees in the array.

2. Pass 2-D Array to Function (Transpose Operation)

• Create a function that accepts a 2-D array.

• Perform the transpose operation (swap rows with columns).

• Return the transposed array to the main function and display it.

3. Function Pointers for Arithmetic Operations

• Define functions for addition, subtraction, multiplication, and division.

• Use a function pointer to point to these functions.

• Allow the user to choose an operation and invoke it using the function pointer.

4. User-Defined Data Type (Generic Data Container)

• Define a structure with a union to store int, float, char, or string.

• Use an enum to track the current data type.

• Implement set and get functions ensuring type safety.

5. Count Duplicate Elements in an Array

• Accept an array as input from the user.

• Use nested loops to find duplicate elements and count them.

• Display the count of duplicates and their indices.


6. Print Upper Triangle of a Matrix

• Read a 2D matrix from the user.

• Print elements above the diagonal (upper triangular part).

• Ensure to handle square matrices.

7. Largest Integer from Array of Distinct Integers

• Input an array of n distinct integers in the range [0, 10000].

• Convert integers to strings and sort them by concatenation results.

• Concatenate in order to form the largest possible number and print it.

8. Sort Names and Addresses Using Structures

• Define a structure containing name and address.

• Input n names and corresponding addresses.

• Sort the array of structures alphabetically by name using strcmp.

• Display the sorted list.

9. Credit Card Number Validation

• Input a 16-digit Credit Card number.

• Multiply every alternate digit (from the rightmost) by 2.

• Subtract 9 from numbers greater than 10.

• Add modified digits and remaining digits.

• Check if the sum is divisible by 10 for validity.

10. Count Two Vowels in Succession in Text

• Read a line of text from the user.

• Traverse the string to identify pairs of vowels in succession.

• Count and display each occurrence (e.g., ea, io, ou).

Would you like full code implementations for any of these programs?

You might also like