Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

numerosPrimos

using System.IO;
using System;


 public class modulo
    {
        public static void Main()
        {
            
            int n,divisor;
            bool esPrimo;
            
            esPrimo=true;
            n=30;
            divisor=n/2;
            
            while(n!=1){
                while(divisor!=1&&esPrimo){
                    if(n%divisor==0){
                        esPrimo=false;
                    }
                    divisor--;
                
                }
                if(esPrimo){
                    System.Console.WriteLine(n);
                }
                n--;
                esPrimo=true;
            }
        }
    }

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.