saving . . . saved Prime number has been deleted. Prime number has been hidden .
Prime number
Title
Question
How to display prime numbers

Advanced-Cpp Abstract-Class 02-03 min 30-40 sec 13-03-22, 8 a.m. moinshaik

Answers:

A meaningful program can be written as follows:
#include<iostream>
using namespace std;
int main()
{
    int i, chk=0, j;
    cout<<"Prime Numbers Between 1 to 100 are:\n";
    for(i=1; i<=100; i++)
    {
        for(j=2; j<i; j++)
        {
           if(i%j==0)
           {
               chk++;
               break;
           }
        }
        if(chk==0 && i!=1)
            cout<<i<<"\n";
        chk = 0;
    }
    return 0;
}
14-03-22, 10:58 a.m. hbammkanti


A meaningful program can be written as follows:
#include<iostream>
using namespace std;
int main()
{
    int i, chk=0, j;
    cout<<"Prime Numbers Between 1 to 100 are:\n";
    for(i=1; i<=100; i++)
    {
        for(j=2; j<i; j++)
        {
           if(i%j==0)
           {
               chk++;
               break;
           }
        }
        if(chk==0 && i!=1)
            cout<<i<<"\n";
        chk = 0;
    }
20-01-23, 9:56 p.m. nakul@7


Log-in to answer to this question.