Pages

Saturday, December 28, 2013

DO-WHILE Loop

Write a Program that describe the state of Cell-Phone, its working or not


Input:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <stdio.h>
#include <conio.h>
void main (void)
{
     char state;
 do
  {
   printf("Enter the current state of Cell-Phone\n(Enter \'W\' for working and \'D\' for dead):  ");
    scanf("%c", &state);
   }
 while (state != 'W' && state != 'D');
 getch();
 }// main
Result:
Enter the current state of Cell-Phone
(Enter \'W\' for working and \'D\' for dead):  W


No comments:

Post a Comment