0% found this document useful (0 votes)
15 views3 pages

RAMADA

The document contains code to determine prime and non-prime numbers between two user-input numbers using nested for loops. It outputs the prime numbers, sleeps for 100 milliseconds, then outputs the non-prime numbers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

RAMADA

The document contains code to determine prime and non-prime numbers between two user-input numbers using nested for loops. It outputs the prime numbers, sleeps for 100 milliseconds, then outputs the non-prime numbers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Reah Mae Ramada

#include <iostream>

#include <cmath>

#include <windows.h>

using namespace std;

int main() {

int numb1, numb2;

cout << "\n\nDetermine Prime Numbers from 1-100.";

cout << "\nPlease Enter the First Number: "<< endl;

cin >> numb1;

cout << "\nPlease Enter the Second Number: " << endl;

cin >> numb2;

cout << "\nPrime numbers between 1 and 100 are :\n\n";

for (int i = numb1; i <= numb2; i++) {

int P = 1;

for (int A = 2; A * A <= i; A++) {

if (i % A == 0) {

P = 0;

Sleep(100);

if (P)

cout << i << " ";


}

cout << "\n\nNon-prime numbers between 1 and 100 are :\n\n";

for (int i = numb1; i <= numb2; i++) {

int NP = 1;

for (int B = 2; B * B <= i; B++) {

if (i % B == 0) {

NP = 0;

Sleep(100);

if (!NP)

cout << i << " ";

cout << endl;

return 0;

You might also like