Showing posts with label How to restart the program. Show all posts
Showing posts with label How to restart the program. Show all posts

Tuesday, 24 May 2011

The do-while Loop / How to restart the program?

#include<stdio.h>
#include<conio.h>
void main()
{
 int num;
 char ch;
 clrscr();
 do{
 printf("Enter a number");
 scanf("%d",&num);
 printf("\n\n");
 printf("You entered %d",num);
 printf("Press 'y' to restart again?");
 ch=getche();
 }
  while(ch=='y');
 getch();

}




If you have question, you can ask me freely!