Docsity

Lab Exercise: Declaring a Structure Variable and Recursive Function in C, Assignments of Programming Languages

Partial preview of the text

Download Lab Exercise: Declaring a Structure Variable and Recursive Function in C and more Assignments Programming Languages in PDF only on Docsity!

Lab

Page. 1

9.1 Declare a structure variable rectangle. Define its two-member variable length and breadth of type float. Create two variables of this structure in main () function. Take date form user for both these variable. Define a function addrectangle (). Pass these two structure variable to this function and add the length and breadth of both rectangles. Display the resultant rectangle sides.

Lab

Page. 2

9.2 Calculate the sum of natural number using recursion. [Hint: if user enter 5, the function will add all the number from 1 to 5 i.e.; 5+4+3+2+1=15]