Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Solve using C
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started