Wednesday, 23 November 2016

Write a program that inputs ten integers in an array and counts all prime numbers entered by the user. The program finally displays total number of primes in array.


        
        #include <iostream.h>
        #include <conio.h>
        int main ()
       {
          
          int array[10], i,c,p;
          int count = 0;

         cout<< " Enter integer numbers: " ;
          for(i=0; i<10; i++)
          {
                 p 1;
                for (c 2; c <array[i]/2; c++)
                {
                    if (array[i]%== 0)
                    p = 0;
                    break;
                 }
             if (p == 1)
               count++;
          }
          cout<< " Total numbers of prime numbers in the array is : " <<count;
          return 0;
       } 



1 comment:

If you have any doubt please let me know

Methods in JAVA Language

 In general, a way may be thanks to perform some task. Similarly, the tactic in Java may be a collection of instructions that performs a sel...