1. Write a user defined function which will swap the values of two variables declared locally in the main program.
2. Write a user defined function calc(), which will returns the sum, subtraction, multiplication, and division values of two variable locally declared in the main function.
3. Write a user defined function which will return the length of the string declared locally in the main function.
4. Write a program, which takes a name of the user in the lowercase letters. Call a user defined function upper which will convert all lowercase letters into the uppercase letter. Finally print the string.
5. Write a user defined function to reverse the given string.
6. Create a structure product with ProductCode (int), Name (char array) and Price data elements. In the main function declare p[5] of product. Do the necessary data entry for all five products. Pass the base address of an array to user defined function inc_price(), which will increase the price of all the products by 10%. Print all the products with all the details again after increasing the price.
7. Create a structure student with rollno (int), name (char array), marks (int), grade (char). Create an array stu[5] of type student. Take the details of students like rollno, name, and marks from the user. Call UDF prepare_result() which will store the values for grade based on marks (if marks >=75 then ‘A’, Between 60 to 75 ‘B’, Between 50 to 60 ‘C’, Between 35 to 50 ‘D’ and Below 35 ‘F’ grade). Print the details of the students with Grade.
1. sum of two number
No comments:
Post a Comment