Printing the string in n Equal parts
Printing the string in n equal parts:
C Program:
Output 1:
Output 2:
From the above program,
ü l=strlen(a) is used to find the length of the string, in the above output the given string is "Dandelions".
ü Length of the above mentioned string is 10.
ü n is the number of parts the string to be divided.
ü div = l/n is used to find the string to be divided and displayed.
In the above mentioned string,
ü Dandelions need to be divided into 5(n=5) then length=10, so the equal parts of the string to be divided will be div = 10/5 =2.
So the string will be divided as 2 equal.
Output will be as,
ü If the same string need to be divided as 2 i.e., n=2 then then equal parts will be div = 10/2 = 5.
Output will be as,
0 Comments