Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

Get Prime Number in dart

     var newArray = List.generate(10000, (index) => index);
 List b=[];


      void checkPrime(int num){
        int i,m=0,flag=0;
        m=num~/2;
        for(i = 2;i<=m;i++){
          if(num%i == 0){
            flag=1;
            break;
          }
        }
        if(flag==0){
          b.add(num);
          // print('num $num');
        }}
        
        
     for(int i=1;i<newArray.length; i++){
      checkPrime(newArray[i]);
     }


     print(b);
Source by hackmd.io #
 
PREVIOUS NEXT
Tagged: #Get #Prime #Number #dart
ADD COMMENT
Topic
Name
2+4 =