Write a program to read in a positive integer, Computer Engineering

Assignment Help:

Write a program to read in a positive integer and check whether it is prime or not?

/* Program to check whether a given number is prime or not*/]

# include

# include

void main()

{

int i=2,n,flag=1;

clrscr();

printf("\nEnter the number : ");

scanf("%d",&n);

while(i

{

if(n%i==0)

{

flag=0;

printf("\n%d is not a prime number",n);

break; /*takes control out of the while as soon as the numbers is fully divisible */

}

else i++;

}

 


Related Discussions:- Write a program to read in a positive integer

What is parallel sections construct, What is Parallel Sections Construct? ...

What is Parallel Sections Construct? The parallel sections construct is a shortcut for specifying a parallel construct comprising one sections construct however no other statem

What is delayed branching, What is delayed branching? A method called d...

What is delayed branching? A method called delayed branching can minimize the penalty incurred as a result of conditional branch instructions. The idea is easy. The instruction

How to build the structure chart, Building the Structure Chart - Proces...

Building the Structure Chart - Processes in the DFD tend to show single module on the structure chart Afferent processes - give inputs to system Central processes -

Secure systems development, Write an academic report on a significant softw...

Write an academic report on a significant software security exploit you have studied. Your report should include details such as, for example: The nature of the software vuln

Draw back of assigning one bit position to control signals, What is the dra...

What is the draw back of assigning one bit position to each control signals? Assigning individual bits to every control signal results in long microinstructions due to the numb

Microprocessor and interfacing, Write an ALP to count positve and numbers f...

Write an ALP to count positve and numbers from array.

What is the motivation for cell design, Question: a) Evary cell in a ce...

Question: a) Evary cell in a cellular network is assigned a band of frequencies. The allocated frequencies are divided into two types of channels. Indentify and describe each t

What do you mean by term procedure, What do you mean by term procedure? Dif...

What do you mean by term procedure? Differentiate between far call and near call? PROC: PROC and ENDP directives indicate the start and end of a procedure. These directives for

Explain what is dtmf signalling, Explain what is DTMF signalling. Dual ...

Explain what is DTMF signalling. Dual Tone Multi Frequency (DTMF) was initially introduced in 1963 with 10 buttons into Western Electric 1500 -type telephones. Dual Tone Multi

Rsa encryption function- cryptography, The general method for constructing ...

The general method for constructing the parameters of the RSA cryptosystem can be described as follows: Select two primes p and q Let N = pq and determine ∅ (N) = (p - 1

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd