Document 2
Document 2
2. Different Operators
Example 2:
Copy code
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
5. Function
WAP to find the sum of two numbers using passing arguments and returning values.
WAP to pass arguments and obtain the value of the sum using passing arguments
but not returning values.
WAP to find the sum of two numbers using passing no arguments and returning
values.
WAP to find the sum of two numbers using no arguments and no return values.
WAP to find the factorial using a recursive function.
WAP to generate a Fibonacci sequence using a recursive function.
6. Array
To store the value input by the user and display them using an array.
To find the smallest element from the array.
To search for a particular element in an array.
Display 10 numbers using an array.
WAP to sort an array in ascending order.
WAP to sort an array in descending order.
To store data in a two-dimensional array and display it.
To find the sum of two matrices.
Perform matrix multiplication.
7. Pointer
8. String
WAP to define a structure to store the record of an employee with id, name, sex,
and salary.
Read a record of an employee from the user and display the record.
WAP to read the data of a book including book id, book name, book price, and
number of pages using a structure and display them.
WAP to create a structure for a student with fields roll number, name, and marks
and display the data.
WAP to create a structure for a point with x and y coordinates and calculate the
distance between two points.
WAP using an array of structures.
WAP to demonstrate the use of a union.
10. File
WAP to ask the name and age of a person and store it in a file named record.dat.
WAP to read from a file and display its contents on the console.
WAP to count the number of characters, words, and lines in a file.
WAP to write the squares of numbers from 1 to 10 into a file.