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

An example subroutine call, Create your own Subprogram that does *not* use ...

Create your own Subprogram that does *not* use any input parameters. You decide the theme. You should give the pseudocode and an example Subroutine call. Be sure to give an overvie

The goal of hashing, The goal of hashing is to produce a search that takes ...

The goal of hashing is to produce a search that takes   O(1) time

Telecommunications, with poisson arrival of two calls per minute what is th...

with poisson arrival of two calls per minute what is the probability that more than three calls will arrive in two minutes? that is the time during which at least 4 calls will arr

Explain essential loop in process scheduling, Explain essential loop in Pro...

Explain essential loop in Process Scheduling . The complex part of scheduling is to balance policy enforcement along with resource optimization so as to pick the best job to run

What is an arithmetic processor, Q. What is an arithmetic processor? A ...

Q. What is an arithmetic processor? A distinctive CPU necessitates most of the control and data processing hardware for implementing non-arithmetic functions. As the hardware c

Describe about data warehouse development life cycle, Data Warehousing 1....

Data Warehousing 1.  With necessary diagram, Describe about Data Warehouse Development Life Cycle. 2. Elucidate Metadata and what is its use in Data Warehouse Architecture?

Bi polar junction transistor, draw input and output charectoristics of BJT ...

draw input and output charectoristics of BJT and justify CE configuration provides large current amplification

Design the communication protocol, Design, write, and implement distributed...

Design, write, and implement distributed networked application using Java Design the communication protocol (message format and exchange procedure) that your application will re

Operation of micro-programmed control unit, Micro-instructions are stored i...

Micro-instructions are stored in control memory. Address register for control memory comprises the address of subsequent instruction which is to be read. Control memory Buffer Regi

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