C Program – Timer program with loop breaking

by Nideesh C on May 9, 2011 · 0 comments

in C Programming




//Downloaded From theonlinetutorials.com
#include "stdio.h"
#include "conio.h"
#include "dos.h"
int main()
{
int i,flag=0;
char s[100];
clrscr();
for(i=30;i>=0;i--)
{
if(kbhit())
 {
 scanf("%s",s);//User want to take input
 flag=1;//Call the operation you require
 break;//Terminate the loop
 }
delay(1000);
printf("\n00:%2d",i);
}
if(flag==1)
printf("User entered %s",s);//If user entered a value display it
getch();
return 0;
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C Program – Timer program
  2. C program to check whether a given number is prime or not and output the given number with suitable message
  3. C program to generate and print prime numbers in a given range. Also print the number of prime numbers
  4. C program to evaluate the given polynomial P(x)=AnXn + An-1Xn-1 + An-2Xn-2+… +A1X + A0, by reading its coefficients into an array. [Hint:Rewrite the polynomial as P(x) = a0 + x(a1+x(a2+x(a3+x(a4+x(...x(an-1+xan)))) and evaluate the function starting from the inner loop]
  5. C Program to accept two matrices and check if they are equal

Leave a Comment

Previous post:

Next post: