program

Discussion in 'Meet and Greet' started by glemiejill, Nov 4, 2010.

  1. glemiejill

    glemiejill New Member

    Joined:
    Nov 4, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    plz solve this following program.
    you are required to write a program which should take input from user in the form of charecters A or B .Based upon's input you should use while loop or do/while loop for taking input and if/else conditin for make decision
     
  2. go4expert

    go4expert Moderator

    Joined:
    Aug 3, 2004
    Messages:
    306
    Likes Received:
    9
    Trophy Points:
    0
    Looks pretty simple and show us your effort and we will be more than happy to help you get this done.
     
  3. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    19
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    http://www.techgeek.in
    use "switch case"
     
  4. kapilmishra16

    kapilmishra16 New Member

    Joined:
    Nov 9, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    kanpur
    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    void main()
    {
     int b,c,i;
     char a;
     i=0;
     printf("enter your choice:\nA for while loop or B for do while loop");
     scanf("%c",&a);
     b=strcmp(a,"A");
     c=strcmp(a,"B");
     if(b==0)
     {
       printf("this is A");
       i++;
       while(i!=1)
      }
     else if(c==0)
     {
     do
     {
       printf("this is B");
       i++;}
       while(i!=1);
      }
     else
     {
      printf("wrong input");
      getch();
      exit();
      }
      getch();
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice