Skip to content
TFE Times

TFE Times

Business, Technology, and Culture

Click here
RPI Leaderboard
University of California Irvine Leaderboard
University of California Irvine Leaderboard
MAFI_728x90
NYU Tandon School of Engineering Leaderboard
MAFI_728x90
University of Maryland Masters of Economics Leaderboard
Brandeis University Master of Finance Leaderboard 728x90
University of Maryland Masters of Economics  Leaderboard
Click here
Click here
  • Business
  • Culture
  • Technology
  • International Rankings
    • Bangladesh
    • Canada
    • Egypt
    • India
    • Nigeria
    • Pakistan
    • Philippines
    • United Kingdom
    • United States of America
  • Masters Rankings
    • Accounting
    • Business Analytics
    • Chiropractic
    • Computer Engineering
    • Computer Science
    • Economics
    • Education
    • Finance
    • Financial Economics
    • Financial Engineering
    • Law
    • Management
    • Marketing
    • MBA
    • Nursing
    • Social Work
  • Resources
    • C++
      • Beginner’s Guide to C++
      • An Introduction to the Imperative Part of C++
      • C++ Code
        • Sorts
        • Binary Search Trees
        • Strings
        • Binary Search
        • Math
        • Quant
        • Puzzles/Games
        • Language Concepts
        • Graphics
        • OS Operations
        • Graphs
      • C++ Full Course
      • C++ Crash Course
      • C++ Interview Questions
      • C++ Q/A
      • C++ Books
      • C++ Free Books
      • C++ Videos
    • C Questions
    • C Programming Tips
    • Java Questions
    • Quant Data Sources
    • Quant Questions

C++: Loop Continue

Posted on September 1, 2017April 1, 2018 by TFE Times
Posted in C++Tagged c, continue, loop, loops
Bjarne-stroustrup
 


Show the following output using one loop.

1, 2, 3, 4, 5
6, 7, 8, 9, 10

Try to achieve the result by forcing the next iteration within the loop upon a specific condition, if your language allows it.

for(int i = 1;i <= 10; i++){
   cout << i;
   if(i % 5 == 0){
      cout << endl;
      continue;
   }
   cout << ", ";
}

SOURCE

Content is available under GNU Free Documentation License 1.2.

Related

Post navigation

Bjarne-stroustrup
← Previous

C++: Langton's Ant

September 1, 2017
Bjarne-stroustrup
Next →

C++: Black Scholes Put Option Rho

September 1, 2017

Related Posts

Bjarne-stroustrup

C++: Harshad/Niven Series

Posted on September 1, 2017April 1, 2018
Bjarne-stroustrup

C++: Evaluate Binomial Coefficients

Posted on September 1, 2017April 1, 2018
Bjarne-stroustrup

C++: Greatest Common Denominator

Posted on September 1, 2017April 1, 2018
University of California Berkeley Master of Financial Engineering MFE Sideboard
University of Maryland Masters of Economics Sideboard
Click here
University of California Irvine Leaderboard
output_8BgzjE
NYU Tandon School of Engineering Sideboard
University of Maryland Masters of Economics Sideboard
Brandeis Business School
  • Top 10 Restaurants in Portland, Oregon

    August 30, 2026June 20, 2026 by TFE Times
  • Top 10 Restaurants in Copenhagen, Denmark

    August 29, 2026June 20, 2026 by TFE Times
  • Best High-Risk Merchant Account Providers

    August 28, 2026 by TFE Times
  • The History of the 9-Iron: From the Niblick to Golf’s Precision Approach Club

    August 28, 2026July 13, 2026 by TFE Times
  • What Should Buyers Check Before Choosing a Low-Cost Texas Home?

    August 27, 2026 by TFE Times
  • Top EOR Platforms for Graduates Seeking Remote Jobs Abroad (2026)

    August 27, 2026August 27, 2026 by TFE Times
  • Significance of White Flower Bouquets in Times of Deep Grief 

    August 27, 2026 by TFE Times
  • Best Red Wines for Beginners

    August 27, 2026July 13, 2026 by TFE Times
  • The Race to Remove Friction: Why Betting Platforms Are Cutting Steps, Not Adding Them

    August 26, 2026 by TFE Times
  • Buy Now, Pay Later Has Come to Healthcare — and It’s Changing How People Get Treatment

    August 26, 2026 by TFE Times

Copyright © TFE Times, LLC. All Rights Reserved.

Terms of Service | Privacy Policy | Disclaimer

WordPress Theme : Eight Paper by 8Degree Themes