#include<stdio.h>
main()
{int i;
do{
printf("*");
scanf("%d",&i);
}while(1);
}
this is a sample program,but u don't look down upon it
when u input a unnummber ,there will no stop!
i want to know why ???????????????????

Well it's not a strange problem considering it's doing what it is supposed to do.

First off, when posting code please use code tags. Read here

Second, main returns an int it should be int main(void).

Third, When writing please use complete sentences and use "you" not "u". Also using a bunch of question marks doesn't make your question more of a question.

Fourth, what your program is doing is looping while (1). This is saying while true repeat(any non zero number is "true"). What you were probably going for was something like this:

#include <stdio.h>

int main(void)
{
    int number;
    do
    {
        /*notice the spacing it makes your code much easier to read*/
        printf("*\n");
        printf("Enter 0 if you want to quit\n");
        scanf("%d",&number);
    
    }while (number != 0);
    
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.