Question

Suppose you are collecting money for something. You need ₹200 in all. You ask your parents, uncles and aunts as well as grandparents. Different people may give either ₹10 , ₹20 or even ₹50 . You will collect till the total becomes 200. Write the algorithm.

✨ Free AI Tools for You

Powered by Chatterbot AI

Answer

Here is the algorithm to collect money until the total reaches ₹200:

Algorithm to Collect ₹200

  1. Initialize total to 0.
    total = 0

  2. While total is less than 200, repeat steps 3 to 5:
    WHILE total < 200 REPEAT

  3. Ask for money contribution:
    INPUT contribution

  4. Check if contribution is ₹10, ₹20, or ₹50:
    IF contribution == 10 OR contribution == 20 OR contribution == 50 THEN

  5. Add the contribution to total:
    total = total + contribution

  6. End the loop.
    END WHILE

  7. Print the total amount collected:
    PRINT total

Pseudocode:

total = 0
WHILE total < 200 REPEAT
    INPUT contribution
    IF contribution == 10 OR contribution == 20 OR contribution == 50 THEN
        total = total + contribution
    END IF
END WHILE
PRINT total

Explanation:

  • Initialize: Start by setting the total amount collected to 0.

  • Loop: Keep asking for contributions in a loop until the total collected is at least ₹200.

  • Input: Get the contribution amount from a family member.

  • Condition: Verify if the contribution is one of the valid amounts ₹10, ₹20, or ₹50.

  • Update: Add the contribution to the total collected.

  • End: Exit the loop once the total reaches or exceeds ₹200 and print the total amount collected.


Was this helpful?

India's 1st AI Doubt Solver for CBSE, JEE, and NEET

Ask a Question for Free

and then it's just ₹212 a month

Learn how Chatterbot AI can help you succeed

Cover Image of the article Computer Science Class 11 CBSE - The Ultimate Guide with Notes, Solutions and AI

Computer Science Class 11 CBSE - The Ultimate Guide with Notes, Solutions and AI

This ultimate guide for CBSE Computer Science class 11 has detailed notes, NCERT solutions, cheat sheets, and our free AI-powered doubt-solving assistant, Chatterbot AI.

Cover Image of the article JEE Advanced 2024 Exam Date Announced: Complete Guide to Eligibility, Syllabus, and Preparation Tips

JEE Advanced 2024 Exam Date Announced: Complete Guide to Eligibility, Syllabus, and Preparation Tips

JEE Advanced 2024 on May 26! Get exam schedule, syllabus, prep tips & more in this guide. Ace India's top engineering test with topper strategies.

Cover Image of the article How to Crack NEET: The Ultimate Blueprint to Outsmart the Exam and Unlock Your Medical Dreams

How to Crack NEET: The Ultimate Blueprint to Outsmart the Exam and Unlock Your Medical Dreams

Ace NEET with expert strategies: Discover effective exam strategies, time management, core concepts mastery, problem-solving techniques, revision tips, and AI-assisted doubt clearing with Chatterbot AI.

Cover Image of the article How to Crack IIT: Smart Self-Study Strategies and AI Tools for Success

How to Crack IIT: Smart Self-Study Strategies and AI Tools for Success

Ace IIT JEE in 6 months without coaching. Discover expert self-study strategies for Physics, Chemistry, and Math. Master time management, mock tests, and leverage AI tools like Chatterbot AI for personalized doubt-solving.