Sunday, March 17, 2013

C++ program to find prime number

10:18 AM

C++ program code to find numbers

#include<iostream>
#include<iomanip>
int main(){
    int num,i,count;
 
    for(num = 1;num<=100;num++){
         count = 0;
         for(i=2;i<=num/2;i++){
             if(num%i==0){
                 count++;
                 break;
             }
        }
       
         if(count==0 && num!= 1)
             cout <<  num  << setw(3);
    }
 
   return 0;
}

 

 ---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------




---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top