Sample Qustion 8

Write a C++ program to find the all the composite numbers below 100.

#include<iostream>
using namespace std;
int main()
{
    int i,n,factor;

    for(n=2;n<=100;n++)
    {
         for(i=1;i<n;i++)
         {
              if(n%i==0)
              {
                   factor=i;
              }
         }
         if(factor>1)
         {
              cout << n <<endl;
         }
     }
      
     return 0;
}



download file  cpp file


do you have any qustion please comment



click the advertisement to help for me ....




Comments

Popular posts from this blog

Java Question Data structure 04

Sample Qustion 1