nested loop c++

#include <iostream>
using namespace std;
 
int main () {
   int i, j;
   
   for(i = 2; i<100; i++) {
      for(j = 2; j <= (i/j); j++)
         if(!(i%j)) break; // if factor found, not prime
         if(j > (i/j)) cout << i << " is prime\n";
   }
   
   return 0;
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
when do we use nested loops in c++ return a variable value from a nested loop in c++ return a value from a nested loop in c++ nested loop c++ program example nested for loops in c++ c++ nested for loop on one line difference between nested loop and for loop in c++ can any loop be nested in any other loop in c++ next in c++ nested loop nested if loops c++ c++ variable nested for loop simulate nested for loop c++ cpp nested for loop break nested for loops cpp nested loop c++ example program how to use nested loops in c++ nested do-while loop in cpp spapes by nested for loop c++ functions nested loop in c++ how do nested for loops work in c++ nested loops c++ examples nested loops in c++ nested outer loop in c+++ how to use nested for loops in c++ break nested for loop c++ alternative of nested for loops on c++ how to fix structure nested function c++ for loop nested for loop in c++ nested loops c++ patterns Write a program of a nested for loop in c++ how to do a nested while loop in c++ how to do a nested loop in c++ nested while loop c++ nested loops c++ c++ nested loop time c++ nested iterators nested loops cpp What is a nested for loop c++ nested for loop c++ please try again nested loop example in c++ nested loop program in c++ nested for loop examples in c++ c++ how nested for loops work nested for loop c++ example problems c++ nested for loop nested loop in cpp nested loop n cpp how to do nested for loops in c++ how to break nested loop in c++ how to use a nested loop in avector in c++ nested loop example c++ c++ nested loop nested loops c++\ if nested for loop c++ while loop with nested for loop c++ nested for loop c++ c++ nested loops nested loop c++
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source