Q:

# C program to read a value and print its corresponding percentage from 1% to 100% using recursion

This code presents a usage of Recursive functions in C.

In this example the user input is broken into its corresponding percentage value for 1%age to 100% using recursion.

``````#include<stdio.h>

//function declaration
int RecursvFcnTogetPrcntge();

float Var;
unsigned int count=1;
float Prcntge;

int main()
{

printf("\nEnter a value to split in percentage: ");
scanf("%f",&Var);

Var=Var/100;
RecursvFcnTogetPrcntge();
printf("\n");

return 0;
}

int RecursvFcnTogetPrcntge()
{

if(count==101)
{
return 1;
}

Prcntge=Var*count;
printf("\n%3d Percent = %.02f",count, Prcntge);
count++;
RecursvFcnTogetPrcntge();
return 0;
}``````

Output

```Enter a value to split in percentage: 1340

1 Percent = 13.40
2 Percent = 26.80
3 Percent = 40.20
4 Percent = 53.60
5 Percent = 67.00
6 Percent = 80.40
7 Percent = 93.80
8 Percent = 107.20
9 Percent = 120.60
10 Percent = 134.00
11 Percent = 147.40
12 Percent = 160.80
13 Percent = 174.20
14 Percent = 187.60
15 Percent = 201.00
16 Percent = 214.40
17 Percent = 227.80
18 Percent = 241.20
19 Percent = 254.60
20 Percent = 268.00
21 Percent = 281.40
22 Percent = 294.80
23 Percent = 308.20
24 Percent = 321.60
25 Percent = 335.00
26 Percent = 348.40
27 Percent = 361.80
28 Percent = 375.20
... and so on...```