Question: Solve using C 3. Ramesh has a machine which makes a garland with given flowers. Initially Ramesh has to feed the sequence of flowers, and

Solve using C Solve using C 3. Ramesh has a machine which makes a garland

3. Ramesh has a machine which makes a garland with given flowers. Initially Ramesh has to feed the sequence of flowers, and then the machine keeps inserting the flowers in the same order in a string repeatedly. Ramesh wants to know the flower at any given nth position and no. of X flower used till nth position. Help him find it. Input format 5: a string sequence of flower color n : The position of the garland c: Color of the flower Output Format Print a single integer denoting the number of " c " colored flowers in the garland. Print a single char denoting the color of the flower in the nth position The students must use functions ColorCount() and NthFlower() Input YRPO 10 P Outpug 2 R Explanation The garland formed is like - YRPOYRPOYR. In the 10 th position R red flower is present and P is repeated 2 times. Input W 1000000000000 W Output 1000000000000 W Explanation Because all of the flowers are W white color the no. of flowers at nth position would be n and the flower color will also be W

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!