Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me solve a scanf problem in a loop

Status
Not open for further replies.

grittinjames

Advanced Member level 1
Joined
Jun 1, 2006
Messages
479
Helped
44
Reputation
90
Reaction score
32
Trophy points
1,308
Location
bangalore india
Activity points
3,985
hai friends

int i=0;

do{

scanf("%d",&i);
printf("%d",i);

while(i>100||i<1);


in this loop if im enternimg a charecter when scanf waiting i will not change it will be 0,
while gety satsfied and again it will move to do ,
but this time scanf is not waiting for entering data ,it becoming an infinite loop

what is the problem
how i can solve it
plz help me
 

Re: scanf is not working

int i=0;

do{

scanf("%d",&i);
printf("%d",i);

8. }while(i>100||i<1);

you forget a close semicolon in the statement 8
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top