FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Number Logic in Programming: Prime Numbers, GCD, and Ternary Operators
NewsProgramming Languages

Number Logic in Programming: Prime Numbers, GCD, and Ternary Operators

via Dev.to PythonArul .A3h ago

1.find the range of prime numbers : Flow Chart: -In python : no1 = 10 while no1 <= 50 : div = 2 flag = True while div <= no1 // 2 : if no1 % div == 0 : flag = False break div = div + 1 if flag : print ( no1 , " is prime " ) no1 = no1 + 1 Output: -In Javascript: let no1 = 10 ; while ( no1 <= 50 ) { let div = 2 ; let flag = true ; while ( div * div <= no1 ) { if ( no1 % div === 0 ) { flag = false ; break ; } div ++ ; } if ( flag && no1 > 1 ) { console . log ( no1 + " is prime " ); } else { console . log ( no1 + " is not prime " ); } no1 ++ ; } -In Java : public class PrimeCheck { public static void main ( String [] args ) { int no1 = 10 ; while ( no1 <= 50 ) { int div = 2 ; boolean flag = true ; while ( div * div <= no1 ) { if ( no1 % div == 0 ) { flag = false ; break ; } div ++; } if ( flag && no1 > 1 ) { System . out . println ( no1 + " is prime" ); } else { System . out . println ( no1 + " is not prime" ); } no1 ++; } } } 2.Find the Greatest of Common Divisor: Flow Chart: -In Python :

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
0 views

Related Articles

👀👀👀
News

👀👀👀

Dev.to • 13m ago

A $20 Billion Crypto Scam Market Faces a New Government Crackdown
News

A $20 Billion Crypto Scam Market Faces a New Government Crackdown

Wired • 14m ago

Senators are pushing to find out how much electricity data centers actually use
News

Senators are pushing to find out how much electricity data centers actually use

The Verge • 1h ago

The Silent Skill That Separates Good Developers from Great Ones
News

The Silent Skill That Separates Good Developers from Great Ones

Medium Programming • 1h ago

Do yourself a favor and stop buying these cheap SSD drives flooding the market
News

Do yourself a favor and stop buying these cheap SSD drives flooding the market

ZDNet • 1h ago

Discover More Articles