Problem 11:
The function/method printFibonacci accepts an integer num, representing a number. The function/method printFibonacci prints first num numbers of fibonacci series.
For example,given input 5, the function should print the string “01123”(without quotes).
It compiles successfully but fails to give the desirable result for some test cases. Debug the code.
void printFibonacci(int num)
{
long num1=0;
long num2=1;
for(int i=1;i<num;++i)
{
printf(“%ld”,num1);
long sum=num1+num2;
num2=sum;
num1=num2;
}
}

Problem 12:
The function/method selectionSortArray performs an in-place selection sort on the given input list which will be sorted in ascending order.
It accepts two arguments-len,an integer representing the length of input list and arr, alist of integers representing the input list respectively.
It compiles successfully but fails to get the desired result .
void selectionSortArray(int len,int *arr)
{
int x=0,y=0;
for(x=0;x<len;x++)
{
int index_of_min=x;
for(y=x;y<len;y++)
{
if(arr[index_of_min]>arr[x])
{
index_of_min=y;
}
}
int temp=arr[x];
arr[x]=arr[index_of_min];
arr[index_of_min]=temp;
}
}

Probelm 13:
The function/method descendingSortArray performs an in-place sort on the given input list which will be sorted in descending order.
It accepts two argument-len of an array and array of elements. It compiles succeszsfully but fails to get the desirable output.
void descendingSortArray(int len, int *arr)
{
int small,pos, i,j,temp;
for(i=0;i<=len-1;i++)
{
for(j=i;j<len;j++)
{
temp=0;
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
}

problem 14:
The function/method patternPrint accepts an argument num,an integer. The function/method patternPrint prints num lines in the following pattern. For example, num=4, the pattern should be
1
11
111
1111
It compiles successfully but fails to print desirable result.
void patternPrint(int num)
{
int print=1,i,j;
for(i=0;i<num;i++)
{
for(j=0;j<=i;j++);
{
printf(“%d”, print);
}