You are on page 1of 4

K. J.

Somaiya College of Engineering, Mumbai-77


(Autonomous College Affiliated to University of Mumbai)
Semester: JAN 2019 - APRIL 2019

Internal Assessment - 2

Max. Marks: 10 Duration: 1hr


Class: FYBTech
Div- B Semester: II

Branch: COMP

Name of the Course: Programming in C

Name
Roll no.
Set no. B
Marks
(Out of 10)
Signature Teacher : Student :

Problem Definition :
C Program to Find the Biggest Number in an Array of Numbers using Recursion

Program :
1. #include <stdio.h>
2. int large(int[], int[] )
3. int main()
4. {
5. int size;
6. int largest;
7. int list[20];
8. inti;
9. printf("Enter size of the list:");
10.scanf("%d", &size);
11. printf("Printing the list:\n");
12.for (i = 0; i< =size ; i++)
13. {
14. list[i] = rand() % size;
15.printf("%d \t", list);
16. }
17. if (size = 0)
18. {
19.printf("Empty list\n");
20.}
21.else
22. {
23. largest = list[i];
24. largest = large(list, size - 1, largest);
25.printf("\nThe largest number in the list is: %d\n", largest);
26. }
27.}

28.int large(int list[], int position[], int largest) ;

29.{

30. if (position == 0)

31. return largest;

32. if (position < 0)

33. {

34. if (list[position] < largest)

35. {

36. largest = list[position];

37. }

38. return largest;

39. }

40. Else

41. return 0;

42.}

Line no. Error instruction with explanation Correct instruction

You might also like