If else statement in C Program

Posted on in Categories , , last updated August 16, 2007

Q. Can you give me example for If else statement in C Program under Linux or TC?

A. C follows universal syntax for if..else. You can use any complier GNU Linux gcc or UNIX or old good TC.

if..else syntax

General if..else syntax is as follows:

if ( condition ) {
   expr_set1;
}
else  {
   expr_set2;
}

If given condition is TRUE, expr_set1 will get executed.
If given condition is FALSE (not TRUE), expr_set2 will get executed.

if..else example

Following example will find out large number from given input:

#include<stdio.h>
int main(){
        int x,y;
        printf("Enter value for x :");
        scanf("%d",&x);
        printf("Enter value for y :");
        scanf("%d",&y);
        if ( x > y ){
                printf("X is large number - %d\n",x);
        }
        else{
                printf("Y is large number - %d\n",y);
        }
        return 0;
}

332 comment

  1. #include<stdio.h>
    int main(){
            int x,y;
            printf("Enter value for x :");
            scanf("%d",&amp;x);
            printf("Enter value for y :");
            scanf("%d",&amp;y);
            if ( x &gt; y ){
                    printf("x is large number - %dn",x);
            }
            else{
                    printf("y is large number - %dn",y);
            }
            return 0;
    }
      1. #include
        main()
        {
        int grade;
        char student[25],section[25];

        clrscr();
        printf(“Enter the name of a student: “);
        scanf(“%s”, &student);
        printf(“Enter the section of a student: “);
        scanf(“%s”, &section);
        printf(“Enter the grade of a student: “);
        scanf(“%d”, &grade);

        if(grade>75)
        printf(“PASSED”);
        else
        print(“FAILED”);

        getch();
        }

        1. friend your “scanf(“%s”, &student); ” is not correct

          the correct is “scanf(“%s”, student); ” thank you.

          1. yes,it should be no & for character string,which means for name. only the character we must include the sign & for the scanf

      2. if statements is a conditional statements that executes on a particular condition
        the syntax is
        if (true) /* Here true means if(12>10) ,this is true so it will execute. */
        {
        execute this code
        }
        else
        {
        else execute this code
        }

      3. In turbo c if clause is used in many places.An example of if statement is
        void main()
        {
        int year;
        clrscr();
        printf(“Enter the year”);
        scanf(“%d”&year);
        if(year%4==0)
        printf(It is a leap year”);
        else
        printf(“It is not a leap year”);
        }

        1. in the if statement instead of “if(year%4==0) “statement if i use “if(year%4) ” then what does it represents can you please explain

      4. The ability to control the flow of your program, letting it make decisions on what code to execute, is valuable to the programmer. The if statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false. One of the important functions of the if statement is that it allows the program to select an action based upon the user’s input. For example, by using an if statement to check a user entered password, your program can decide whether a user is allowed access to the program.

    1. #include
      #include
      void main()
      {
      int x,y,large;
      clrscr();
      printf(“input any two number”);
      scanf(“%d %d”,&x,&y);
      if(x > y)
      {
      printf(“large is =%d”,x);
      }
      else
      {
      printf(“largeis =%d”,y);
      }
      getch();
      }

      1. When we use int main() instead of void main(), it must be return 0. If u write void main(), none it to give return 0.

  2. I need more if else program.i have simple problem.i don’t know your wbsite is active or not.next time i give a problem please solve it.

      1. #include
        #include
        main()
        {
        int age;
        clrscr();
        printf(“Enter the age:”);
        scanf(“%d”, &a);
        if(a<18)
        printf("can't vote");
        else
        printf("can vote");
        }

        1. its wrong miss meera actually, wat u declared is age, and wat u using in (if statement) is a thats y its an error program

        2. #include
          #include
          void main()
          {
          int age;
          clrscr();
          printf(“enter age=”);
          scanf(“%d”,&age);
          if(age>18)
          {
          printf(“can vote”);
          }
          else
          {
          printf(“can’t vote”);
          }
          getch();
          }

        3. #include
          #include
          void main()
          {
          int n;
          clrscr();
          printf(“enter the number:”);
          scanf(“%d”,&n);
          if (n%2==0)
          printf(“the number is even”);
          else
          printf(“the number is odd”);
          getch;
          }

            1. Hello. Im not addie, I just to answer your question If im not mistaken getch means get character means that when you run the program and you enter a number it will be saved and clrscr is to erase all number that you entered before. :)

      2. #include
        main();
        {
        int marks;
        scanf(“%d”,&marks);
        if(marks>35)
        printf(“Pass”);
        else
        printf(“Fail”);
        }

      3. PROGRAM To find whether a given year is leap or not
        main()

        {

        int y,r1,r2;

        printf(“Enter a year”);

        scanf(“%d”,&y);

        r1=y%4;

        if (r1 = = 0)

        {

        r2=y%100;

        if(r2 = = 0)

        printf(“The given year is not a leap year”);

        else

        printf(“The given year is a leap year”);

        }

        else

        printf(“The given year is not a leap year”);

        }

            1. bro u used twice dat else statement for printing the gvn year is nt a leap year which is wrong!!
              u strtd in othr bracket within da if statement vch is nt possible!!

              1. how to create this program “You are required to write a program that finds the number (in the given range) which has maximum number of divisors. The program first asks the user to input two values P and Q for a range (where p < Q). After that, the program should find a number having highest number of divisors. In the end, the program should print that numbers (having highest number of divisors) along its divisor count.
                Sample Inputs:
                Enter first number (P): 1
                Enter second number (Q): 10

                Sample Output:
                6 has maximum of 4 divisors.
                "

      4. void main()
        {
        int num,grenum;
        grenum=10;
        printf(“Enter the number: “);
        scanf(“%d”,&num);
        if(num>gernum)
        {
        printf(“The number is Greater”);
        }
        else{
        printf(“The number is smaller”);
        }
        }

  3. hi i am a n IT student. i just want to ask if you could pls give me some simple problems regarding if else , if else if else, and i/o. and also those more complicated ones. thanks.

    1. #include
      main()
      {
      int age;
      Printf(“Age selection for Security”);
      scanf(“%d”,&age);
      if(age<50)
      printf("Selected");
      else
      pritnf("Age excess-Sorry try Another place");
      }

    2. void main()
      {
      int i,n;
      printf(“Enter the level\n”);
      scanf(“%d”,&n);
      for(i=0;i<n;i++)
      {
      if(i%2==0)
      {
      printf("even number=%d",i);
      }
      else
      {
      printf("odd number=%d",i);
      }
      }
      }

  4. i need to create program right now for my project …………….help me …………………hehehe using IF ELSE STATEMENT

    1. #include
      #include
      void main()
      {
      float mob.mt, per;
      clrscr();
      printf(“\n enter the obtained marks:”);
      scanf(“%f” , & mob);
      printf(“\n enter the total marks in exams;”);
      scanf(“%f” , & mt);
      per= mob/tm* 100;
      if(per>=40.0)
      {
      printf(“\n pass”);
      }
      else
      printf(“\n fail”);
      }
      getch();
      }

    2. void main()
      {
      int a;
      printf(“enter the a value\n”);
      scanf(“%d”,&a);
      if(a>0)
      printf(“a is positive”);
      else
      printf(“a is negative”);
      }

  5. can you help me to write this home work in C programs

    *wirte the programsin C about if else
    *the program should ask the user to enter the total marks out of 100, and then display the letter grade on the screen
    *Grade Rules:
    75 and above=”A”grade
    60-74=”B”grade
    50-59=”c”grade
    40-49=”D”grade
    Below 40=”Fail”

    thanks .
    please send it to my Email [email protected]

    1. Your homework is very easy just use the
      if(user>=75)
      printf(“A”);
      else if(user>=60 && user<=74)
      printf("B");

      and so on.

    2. void main()
      {
      float mark;
      clrscr();
      printf(“Enter the total mark out of 100”);
      scanf(“%f”,&mark);
      if(mark<==75)
      {
      print{"Student has secured A Grade ";
      }
      else
      {
      .
      .
      .
      .
      .
      .
      getch();
      }

    3. #include #include
      void main(){
      int i,j,k,l,m;
      clrscr();
      printf(“Enter your total marks”);
      scanf(“%d”,&i);
      if(i>=75){ printf(“Grade-A”);}
      if(i=60){printf(“Grade-B”);}
      if(i=50){printf(“Grade-C”);}
      if(i=40){printf(“Grade-D”);}
      if(i<40){printf("Fail");}
      getch();
      }

  6. i need some help guys
    i am making a function oriented program and i used if else statement, i know that my statement is right but there is only 1 error and it says misplaced else…..
    how can i fix that?
    pls help me….
    plss notify me on my email
    thanks

    1. hey else ya if ke baad semi colon ya brackat hoga isliye yeh erro aa rahi hai …………..
      for example
      else();
      if()
      so if and else use without any syntax…..
      for example
      if(condition)
      {
      statements(s)
      }
      else
      {
      statament(s)
      }
      ok byyyyyyyyyyyeeeeeeeeeeeeeeeeeeee

      1. can anyone answer this: turbo C programming
        Write a program that will accept 5 integer numbers and will display lowest to highest number among the inputs. assuming that there are no equal inputs. please
        kindly need your help anyone

        kindly need your help guys

  7. pls. give me a program example of official receipt of sm using if else statement pls. we need it badly…pls…thanx

  8. using visual basic net i have to write a program using if-else statement based on the following condition the grdes of the students
    0-49 D
    50-55 C
    56-60 C+
    61-70 B
    71-75 B+
    76-85 A
    86-100 A+

    The program should repeat itself unless the user enters a negative value to terminate the program

  9. include
    int main(){
    int x,y;
    printf(“Enter value for x :”);
    scanf(“%d”,&x);
    printf(“Enter value for y :”);
    scanf(“%d”,&y);
    if ( x > y ){
    printf(“x is large number – %d\n”,x);
    }
    else{
    printf(“y is large number – %d\n”,y);
    }
    return 0;
    }

  10. PLEASE HELP ME!!!!

    Can you answer the code of this?
    The output is:

    Enter the first number:
    Enter the second number:
    Enter the third number:

    The smallest number is:
    The middle number is:
    The largest number is:

    1. This is a Dev c++ software.. and if you’re using turbo c… just add –>clrscr();

      #include
      #include

      int main ()
      {
      int n1,n2,n3;
      int small, medium, large;
      clrscr();
      printf(“Enter the first number:”);
      scanf(“%d”,&n1);
      printf(“Enter the second number:”);
      scanf(“%d”,&n2);
      printf(“Enter the third number:”);
      scanf(“%d”,&n3);

      large=0;
      if (large<n1) large=n1;
      if (large<n2) large=n2;
      if (largen1) small=n1;
      if (small>n2) small=n2;
      if (small>n3) small=n3;

      medium=0;
      if (medium<n1 && medium!=large) medium=n1;
      if (medium<n2 && medium!=large) medium=n2;
      if (medium<n3 && medium!=large) medium=n3;

      printf(“The smallest number is:%d\n”,small);
      printf(“The middle number is:%d\n”,medium);
      printf(“The largest number is:%d\n”,large);
      getch();
      return 0;
      }

    2. Sorry about the first one, there are some errors…

      This is a Dev c++ software.. and if you’re using turbo c… just add –>clrscr();

      #include
      #include

      int main ()
      {
      int n1,n2,n3;
      int small, medium, large;
      clrscr();
      printf(“Enter the first number:”);
      scanf(“%d”,&n1);
      printf(“Enter the second number:”);
      scanf(“%d”,&n2);
      printf(“Enter the third number:”);
      scanf(“%d”,&n3);

      large=0;
      if (large<n1) large=n1;
      if (large<n2) large=n2;
      if (largen1) small=n1;
      if (small>n2) small=n2;
      if (small>n3) small=n3;

      medium=0;
      if (medium<n1 && medium!=large) medium=n1;
      if (medium<n2 && medium!=large) medium=n2;
      if (medium<n3 && medium!=large) medium=n3;

      printf(“The smallest number is:%d\n”,small);
      printf(“The middle number is:%d\n”,medium);
      printf(“The largest number is:%d\n”,large);
      getch();
      return 0;
      }

    3. #include

      void main()
      {
      int a,b,c;
      printf(“Enter first number–>”);
      scanf(“%d”,&a);
      printf(“Enter Second number–>”);
      scanf(“%d”,&a);
      printf(“Enter Third number–>”);
      scanf(“%d”,&a);
      if(a>b && a>c)
      {
      printf(“The largest number is->%d”,a);
      if(b>c)
      {
      printf(“The middle number is –>%d”,b);
      printf(“The smallest number is— >%d”,c);
      }
      else
      {
      printf(“The middle number is–>%d”,c);
      printf(“The smallest number is – >%d”,b);
      }
      }
      else if(b>c)
      {
      printf(“Largest number is —>%d”,b);
      if(a>c)
      {
      printf(“The middle number is –>%d”,a);
      printf(“The smallest number is— >%d”,c);
      }
      else
      {
      printf(“The middle number is–>%d”,c);
      printf(“The smallest number is – >%d”,a);
      }
      }
      else
      {
      printf(“Largest number is —>%d”,c);
      if(b>a)
      {
      printf(“The middle number is –>%d”,b);
      printf(“The smallest number is— >%d”,a);
      }
      else
      {
      printf(“The middle number is–>%d”,a);
      printf(“The smallest number is – >%d”,a);
      }
      }

  11. #include
    main()
    {
    int x,y,z;
    clrscr();
    printf(“Enter the first number:”);
    scanf(“%d”,&x);
    printf(“Enter the second number:”);
    scanf(“%d”,&y);
    printf(“Enter the third number:”);
    scanf(“%d”,&z);
    z=x+y+z;
    y=x+y+z;
    x=x+y+z;
    printf(“The smallest number is:%d\n”,z);
    printf(“The middle number is:%d\n”,y);
    printf(“The largest number is:%d\n”,x);
    getch();
    return 0;
    }

    1. Can u help me on this one?I need to create a program which tells the user what color he chose using codes:

      Bl- Blue
      G-Green
      (so on and so forth)

      i did use char color;
      then
      if (color==”Bl”)
      {
      printf (“You chose BLUE”);
      }
      else
      {
      printf (“Pick another color:”);
      }
      getch ()
      }

      The thing is there is no error but the result is only “PICK ANOTHER COLOR”. It means that the condition is not read isn’t it?

      pleease help me..

  12. can you make a program in this question?

    plss reply at my email address, asap!!!

    Objective:To learn how to write a C++ program using switch and do-while loop as applied to a simple airline application.

    Procedure:

    Write a program that will validate the status code so that only values from 0 to 3 will be accepted.If an invalid status code is entered, display the message “Invalid Status” and repeatedly accept a status code until a valid value is entered.Repeatedly accept passenger data prompting for “More Entries? (Y/N):” each time a set of data is entered.Terminate processing when response to this prompt is ‘N’.

    Note: for string values you need to use strcpy function to assign the value entered to a character array variable (refer to your manual).

    Name: XXXXXXXXXXXXXXXXX

    Status:XChecked-in

    Fare:9,999.99

    Specifications:

    1.The name of student and exercise no. should appear on screen.

    2.Segregate input, process, validation and output statements by introducing void functions

    3.Maintain the same display format as follows taking consideration of the error message and the “More Entries” prompt.

    Name: XXXXXXXXXXXXXXXXX

    Status :XBoarded

    Fare:9999.99

    More Entries? (Y/N):

    4.Use the switch statement to display the corresponding descriptive status.

    Statusdescription

    0On-Schedule

    1 Checked-In

    2 Boarded

    3 Arrived

    1. #include
      main()
      {
      int month;
      printf(“\n Enter Number:”);
      scanf(“%d”,&month);

      switch(month){
      case 1: printf(“January”);
      break;
      case 2: printf(“Febuary”);
      break;
      case 3:… and so on up to case 12..

      default: printf(“number selected is invalid”);
      }
      }

  13. i want to do a menu using if else,but after i try the error is occur.the error say that i using illege if else..wat is the problem that i face ,n how can i solve tis problem

  14. can you make a program that converts the value of binary to decimal, binary to-octal binary-hexa and decimal-binary, decimal-octal, decimal-hexa, and octal-decimal,octal-binary,octal-hexa, and hexa-binary,hexa-decimal,.hexa-octal;
    your prompt reply is highly appreciated. thank you in advance.!
    god bless..

  15. -SAMPLE “IF ELSE” PROGRAM-

    #include
    #include

    int main(){
    int grade;
    clrscr();
    printf(“Enter Grade:\n”);
    scanf(“%d”, &grade);

    if((grade>=80)&&(grade=75)&&(grade<=79))
    printf("Nice");

    else
    printf("Poor");

    getche();
    return 0;
    }

  16. can you make a program in this output?

    output
    MODE OF PAYMENT
    [1] CASH 10% DISCOUNT
    [2] TWO-INSTALLMENT 5% INTEREST
    [3] THREE-INSTALLMENT 10% INTEREST

    ENTER YOUR TUITION FEE: 20,000
    CHOOSE MODE OF PAYMENT: 1
    THE AMOUNT OF PAYMENT:18,000

    this is the output plsss. help me

  17. can any one solve this:
    write a c program tht accept n integear from the user and pass it to the function that print the crossponding day 1=saturday
    2=sunday
    3=monday
    4=tuesday
    5=wednesday
    6=thursday
    7=friday

    1. #include
      #include
      void main()
      {
      int no_day;
      clrscr();
      printf(“enter the number of day \n”);
      scanf(“%d”,&no_day);
      switch(no_day)
      {
      case 2 :
      printf(“sunday”);
      break;
      case 3 :
      printf(“monday”);
      break;
      case 4 :
      printf(“tuesday”);
      break;
      case 5 :
      printf(“wednesday”);
      break;
      case 6 :
      printf(“thursday”);
      break;
      case 7 :
      printf(“friday”);
      break;
      default :
      printf(“no match “);
      }
      getch();
      }

  18. Can anyone tell me what will be the output of the following code.
    P.S. Ignore the errors in the statements. Just know that this is the logic.
    int a = 10;
    if (!!a)
    printf(“%d”,!a);
    else
    printf(“%d”, a)

  19. void main(){
    int i;
    switch(i){
    case 1:
    Printf(”monday”);
    case 2:
    Printf(”tuesday”);
    case 3:
    Printf(”wednesday”);
    Case 4:
    Printf(”thursday”);
    .
    .
    .
    Case 7:
    Printf(”sunday”);
    Default:
    Printf(”enter appropriate number”);
    }
    }

  20. 1. Prompts the user to input a percentile mark (i.e. prints a string asking the user to input a value between 0 and 100);
    2. Reads a value from standard input and saves it in an appropriate variable (note: marks can be fractional);
    3. Prints an error message if the mark entered is less than 0 or greater than 100;
    4. If the mark is in range (i.e. between 0 and 100, inclusive) then print out the appropriate letter grade of the mark according to the following scale:
    * 90+ = A+
    * 80+ = A
    * 75+ = B+
    * 70+ = B
    * 65+ = C+
    * 60+ = C
    * 55+ = D+
    * 50+ = D
    * < 50 = F

  21. can you help me with this…

    ADDI, is one of the courier company that provide express service in delivering goods to customers. The tariff are based on total weight and delivery destination. Table below shows the pricelist.
    Table 1 : Weight
    Total Weight Price per kg

    1st kilogram 15.00

    The next 4kg ( 2-5kg) 13.00

    The next 20kg (6-25 kg) RM 11.00

    More than 25 kg RM 10.00

    Table 2 : Destination
    Destination Rate
    Within a state
    i. 1-25km
    i. RM 5
    ii. More than 25 km ii. RM 15
    Domestic RM 30

    For express delivery (within 1 day delivery), extra RM 25.00 is add.
    You are required to write a program that will help customer to calculate the tariff based on information given. Your program shall display:
    • Type of goods – documents or parcel
    • Quantity
    • Total weight
    • Destination
    • And delivery type – normal or express
    • Total price to be paid

  22. can someone halp me with this?

    every week from monday to friday you go to class. when it is raining, you take an umbrella.
    but on the weekend,what you do depends on the weather. if it is raining, you stay indoors. otherwise, you have fun outdoors.
    write a c program to present your weekly program using if/else control statements.

  23. can anyone help me to convert binary to octal by using for loop and bit wise operator.
    what does bit wise (n>>i &7) mean and in last for loop what does i -= 3 mean.how is it related to convert octal.can anyone please help me this,

  24. how to compare two number using bitwise… compare means is two number is less than or greater than each other . if suppose a and b are the two number we normailly compare by using
    if(a>b)
    …..
    else
    ….
    how can i do it by bitwise … :D

  25. Can someone help me solve this assingnment ? am submiting it soon.Thanks

    The manager, Mini Bit of the Megabyte mall wants a program to help his salespersons instantly determine the price of items purchase by their customers. To start with the manager wants a program that will be used to compute the prices of the following provisions: Fanta, Coke, Chocolate and Sprite. As a programmer you have been directed to come up with a program that will determine the item’s under consideration (eg. Fanta, coke, or…….) and ask for the price quote on the item as well as the number of that particular item you purchased. With this information the program should be able to calculate the total price someone is supposed to pay on the item.
    Start from requirement and end at design
    [15

    1. I want a program to display days of week like Monday Tuesday Wednesday etc when we give the year month and the date..i need it by tomorrow morning pls

    1. #include
      int main(){
      int x,y;
      printf(“Enter value for x :”);
      scanf(“%d”,&x);
      printf(“Enter value for y :”);
      scanf(“%d”,&y);
      if ( x > y ){
      printf(“x is large number – %d\n”,x);
      }
      else{
      printf(“y is large number – %d\n”,y);
      }
      return 0;
      }

      1. if else statement is that:
        if statement provides the facility to take action provided that some given condition is true. it does not allow to take action if the given condition is false. tha if_else statement gives this opportuinty.. the syntax of if_alse statement is;

        if(condition)
        {
        statement 1;
        statement 2;
        .
        .
        .
        statement n;
        }
        else
        {
        statement 1;
        statement 2;
        .
        .
        .
        statement n;
        }

        the statement given before the else part vill be executed. if the given condition is true & in case of false statement,the statements given after the else vill be executed…..
        do u need a perfect xmple of if_else statement????

  26. Hi, can u help me now pls ? ahm, how to do this:
    1. When I input F it displays female
    2. When I input M it inputs male ?

  27. plss help me with this one !!
    A salesman is paid a commission on the following basis
    Sale Value Commission
    up to $100 zero
    over $100 to $1000 2%
    over $1000 3%

    Enter the sale value and print out the commission value (use a maximum entry value of $32000)

  28. can u help me to get the c code of this….
    enter the first no:20
    enter the second no:30
    selection operation:+,-,/,%

  29. can you give me a program for votation?? dat would also count the votes and declare who will win !!! please??? i’m begging you guys..!!!

  30. Kindly please help me with this:

    Write a program that ask the user to input item name, item unit per price and item quantity. Determine the following:

    Range(Quantity) Discount
    0-50 0%
    51-90 1%
    90-100 2%
    101-500 3%
    501-1000 5%
    1001-5000 7%
    5801-above 10%

  31. Can you help me figure out this problem?

    This game is like the traditional “bato-bato pick” we Filipinos play. In this game, the user will select among “BATO”, “PAPEL”, and “GUNTING”. The computer will randomly select it’s pick. The game will be played for 5 rounds. The program will display the winner every after round and the player with the most win after 5 rounds will be declared as the winner. In case of a tie provide another round until the tie is broken.

    Kindly help me. Using C Language programming only, Using if-else statement without the use of loop or jump. Thanks

  32. 1 scan four values from user and find maximum number from four numbers.

    2.read any character from user and check whether that character is vowel or not . using conditional operator. (a,e,i,o,u are called vowel)

  33. Can you make a c program on this problem please:
    -make a c program using “if else statements” where when you enter a month(in small letters), it will display the holidays on that month!
    please, email me!

  34. /*Write a c program to accept any character and print their ASCII code.
    sol:-
    #include
    #include
    void main()
    {
    clrscr();
    char ch;
    printf(“\nEnter any character:-“);
    scanf(“%c”,&ch);
    printf(“ASCII code=%d”,ch);
    getch();
    }

    1. if else statement is that:
      if statement provides the facility to take action provided that some given condition is true. it does not allow to take action if the given condition is false. tha if_else statement gives this opportuinty.. the syntax of if_alse statement is;

      if(condition)
      {
      statement 1;
      statement 2;
      .
      .
      .
      statement n;
      }
      else
      {
      statement 1;
      statement 2;
      .
      .
      .
      statement n;
      }

      the statement given before the else part vill be executed. if the given condition is true & in case of false statement,the statements given after the else vill be executed…..

    2. #include
      #include
      void main()
      {
      int a=10,b=20,c=30,d=40;
      if (a<b && a<c && a< d)
      printf("A is smallest");
      else if (b<a &&b<c &&b<d)
      printf(" b is smallest );
      else if (c <a && c<b && c <d)
      printf("c is smallest");
      else
      printf("D is smallest");
      getch()
      }

  35. can any one please send me a program to accept five numbers from console and then to dispaly them back on console in ascending number

  36. I need help with writing a program that prompts the user to enter two dates and then indicate which date comes earlier on the calendar

    Enter first date (mm/dd/yy): 3/6/08
    Enter second date (mm/dd/yy): 5/17/07
    5/17/07 is earlier than 3/6/08

    Your help would be greatly appreciated!!!!!

  37. The program allows user to perform the operations of a calculator, namely addition, subtraction, multiplication and division. However, these four operations will be implemented slightly differently and they are described below.

    You must use functions to implement these arithmetic operations. The function prototypes and their descriptions are as follows:

    int add( int num1, int num 2);
    – returns the sum of num1 and num2.

    int subtract( int num1, int num2 );
    – returns the difference of num1 – num2

    int multiply( int num1, int num2 );
    – returns the product of num1 and num2. You are not allow to use the * operator. Use a loop and the add() function to implement the multiplication. Note that the product of num1 and num2 is equal to (num1 added num2 times).

    int divide( int num1, num2 );
    – returns the quotient of num1 divided by num2. If num2 is zero, it prints an error message (division by zero is invalid) and it returns the value 0.

    In addition to the functions above, the program should also have a function which prints out a nice menu that prompts the user for input. The user will always enter two numbers. The user’s input is to be interpreted in the following way.

    1. If both numbers are non-negative, it means the user wishes to perform multiplication of the two numbers.
    2. If only one number is non-negative, it means the user wishes to perform division.
    3. If both numbers are negative and the first number is bigger than the second number, then the user wishes to perform subtraction.
    4. If both numbers are negative and the first number is smaller than the second number, it means the user wishes to perform addition.
    5. If both numbers are negative and have the same value, it means the user wishes to quit the program.

    The program should allow the user to enter two numbers and then perform the corresponding task. This process should be repeated until the user enters the appropriate numbers (two negative numbers of equal value) to quit the program.

    When the user chooses to quit the program, your program should print out the following statistics. This should be done using a function. The statistics are:
    1. A count of how many times the user has performed each of the addition, subtraction, multiplication and division operations.
    2. A count of the total number of operations performed.

    help me pls….apply the use of nest if else, loops, function

  38. Reading everything but the original post made me feel dumber. To everyone:
    1) Learn how to spell. and when and when not to capitalize
    2) Actually learn something about C before coming here.

  39. can you make a program in this output?

    output
    MODE OF PAYMENT
    [1] CASH 10% DISCOUNT
    [2] TWO-INSTALLMENT 5% INTEREST
    [3] THREE-INSTALLMENT 10% INTEREST

    ENTER YOUR TUITION FEE: 20,000
    CHOOSE MODE OF PAYMENT: 1
    THE AMOUNT OF PAYMENT:18,000

    this is the output plsss. help me

  40. Pls help me. A programe which accpt three no. & if the 1st no. Is 3rd no. Then print sqare other wise multiply is by 3. If 1st no. Is >2nd no. But <3rd no. Then prnt gud question . Else print boaring question.

  41. Ans.

    #Include
    #include
    void main()
    {
    int n1, n2, n3;
    clrscr();
    printf(“enter three no.”);
    scanf(“%d,%d,%d; &n1,n2,n3”);
    if (n1>n3)
    printf(“n1 is largest”);
    else
    printf(“n3 is largest”);
    }
    else
    {
    if (n2>n3)
    printf (“n2 is largest”);
    else
    printf (“n3 is largest”);
    }
    getch();
    }

  42. please help me..
    can you do for me this question?
    Write a program that is capable of finding the 2 largest and 2 smallest integers.
    As input, the program is to read the data from the data file TWOMM.DAT.
    This data file consists of
    line 1 int1 int2 int3…………int10
    line2 int11 int12 int13……int20

    Write the output to the screen in the form:

    The two largest values in the list are:
    … …..
    The two largest values in the list are:
    ….. …..

  43. help me please..do this answer..
    Write a program that is capable of finding the 2 largest and 2 smallest integer in a list of 20 integers.
    As input, the program is to read the data from the data file TWOMM.DAT.
    This data files consists of

    line 1 int1 int2 int3 ……………………..int10
    line 2 int11 int12 int13……………………….int20

    Write the ouput to the screen in the form:
    The two largest values in the list are:
    ….
    The two largest values in the list are:
    ……

  44. #include
    void main()

    {
    int a,c,e,hours,wage,salary;
    printf(“enter hours\n”);
    scanf(“%d”,&a);
    salary=a*10;
    if(hours<=40)
    printf("salary=%d",salary);
    else
    printf("enter no hours");
    scanf("%d",&c);
    printf("enter the wage");
    scanf("%d",&e);
    salary=((c-40)*15)+(400);
    printf("salary=%d",salary);
    }

    1. i havE tO makE a salary calculatOr, in which if a worker works for <=40 hours he will get 10$
      but fOr EvEry Extra hOur abOvE 40 hE wiLl wagE 1.5 timEs morE.. :/
      Outputs shOuld bE likE this: E.g.
      39 hOurs= 390 $
      40 hOurs= 400 $
      41 hOurs= 415 $
      42 hOurs= 430 $..
      can anyonE hElp.. :|

  45. Help me plss i dont run. idont make. pls explore . . .

    1. The proper divisors of a positive integer n are those integers, excluding n itself,
    that
    divide n exactly. For example, the proper divisors of 12 are 1, 2, 3, 4 and 6.
    Write a program that inputs a positive integer and outputs its proper divisors.
    Sample run :
    Input: 8
    Output: 1 2 4
    2. A program that accepts a set of integers and displays the number of positive and negative
    numbers. The program stops when the user enters 0 for the integer value.

  46. 2. Write a program that reads the marks of a student, determine and prints the equivalent grade, based on the following:

    Marks Range Grade
    < 45 E
    45 <= Marks < 60 D
    60 <= Marks < 75 C
    75 <= Marks = 90 A

    i got do.but there got some error that i can’t find.please help me.

    #include
    void main()
    {
    int mark;
    char grade;

    printf(“Enter your mark:”);
    scanf(“%f”,&mark);

    if(mark<45)
    grade='E';

    else if(mark<=45 && mark<60)
    grade='D';

    else if (mark<=60 && mark<75)
    grade='C';

    else if(mark<=75 && mark=90);
    grade=’A’;

    printf(“Your grade is %c\n”,grade);

    }

  47. Please give me answer for this question
    Suppose a company decides to raise the salaries of its employees according to the following table:

    employee_status years_of_service percent_raise
    Full-time Less than 5 years 4.0
    Full-time 5 years or more 5.0
    Part-time Less than 5 years 2.5
    Part-time 5 years or more 3.0

    If employee_status value is ‘F’, the employee is Full-time; if it is ‘P’, he or she is part-time. Using any selection control structure of your choice, write a program that computes the new salary of an employee given his or her employee_status, years_of_service and salary by the users.

  48. Write a program that prompts the user to input an integer between 0 and 25. If user enters 0 then Display A, if user enters 1 then Display B, if user enter 2 then Display C and so On…

  49. can someone solve this problem for me .
    ~ leave a comment “//” of their use and function..

    [1]van arrives
    [2]passenger arrives
    [3]passenger boards van
    [4]van leaves

    each van has the following properties: plate number, driver,passenger, limit
    let letters represent passenger vans and numbers represent passenger
    flow of van and passenger is as follows
    raymark: IF event 1 happens, then a van arrives at the terminal..
    starting with label A
    there can only be one passenger van at the terminal
    at a time
    hence
    if event 1 happens while there is still a van at the terminal, . message saying “terminal is full”
    should be displayed. the next van that arrives at the terminal should be labeled as b and so on

    if event 2 happens, a passenger arrives at the terminal, starting with label 1, if there is a van at the terminal, then the passenger boards the van automatically(event3). otherwise, the passenger waits in a queue. once a van arrives the passenger un the queue will automatically load the van.

    a van automatically leaves the terminal(event4) if the number of a passenger who have boarded is equal to the passenger limit of the van
    the foolowing information mus be displayed at all times: current van label and passenger list.

    you are to write an iterative, menu driven JAVA APPLICATION that simulates the van at ATC

    the following implementation details are req: functions use of control structures – selection and control and use of variable

    ( free to organize your menu choices as long as the feature described above . )

    Your help would be greatly appreciated!!!!!
    send to my email..

  50. Write a program in which user enters the integer value and your program returns its binary equivalent. can any body help me with it?

  51. can u just tell me, wat condition shuld be placed inside for loop

    if( )
    {
    printf(“abcd”);
    else
    printf(“acdb”)
    }

    it should give output as

    abcd
    acdb

    or

    acdb
    abcd

    pls can u just tell me wat condition should be given inside if loop..

    1. Dude it will print “abcd” when condition is true otherwise when condition is false it will put “acdb”…to make neat and easy code using ‘For’ loop try to give “TRUE” condition.like wrote below:
      if (num>0)
      printf(“You have Entered positive number”);
      else
      printf(“You have Entered nagative number”);

  52. help me please. I need to make a program entering someone’s birthday and the current date today and it will identify your age. How??

  53. /*Create a C++ Program that will input
    two (2) values and will output its:
    -> sum -> exponent product
    -> difference -> square root of the first value
    -> product -> square root of the second value
    -> quotient -> remainder/modulo quotient
    -> integer quotient */

    #include
    #include

    using namespace std;

    int main()
    {

    double Number1,Number2,IntegerQoutient;
    double Sum,Difference,Product,Qoutient;
    double ExponentProduct,squareroot1,squareroot2,remainder;

    cout <<"This is a calculator" << endl;

    cout <> Number1;
    cout <> Number2;

    Sum=Number1+Number2;
    Difference=Number1 – Number2;
    Product=Number1 * Number2;
    Qoutient=Number1 / Number2;
    IntegerQoutient=Number1/ Number2;
    ExponentProduct=pow(Number1,Number2);
    squareroot1=sqrt(Number1);
    squareroot2=sqrt(Number2);
    remainder=fmod(Number1,Number2);

    cout <<"OPERATION:" << endl;
    cout < Press 1″ << endl;
    cout < Press 2″ << endl;
    cout < Press 3″ << endl;
    cout < Press 4″ << endl;
    cout < Press 5″ << endl;
    cout < Press 6″ << endl;
    cout < Press 7″ << endl;
    cout < Press 8″ << endl;
    cout < Press 9″ << endl;
    int n;

    cout << "Please choose any from the option above " <> n;

    if (n==1)
    cout <<"Youve chosen Addition, the answer is: "<< Sum << endl;
    else if (n==2)
    cout <<"Youve chosen Subtraction, the answer is: "<< Difference << endl;
    else if (n==3)
    cout <<"Youve chosen Multiplication, the answer is: "<< Product << endl;
    else if (n==4)
    cout <<"Youve chosen Division, the answer is: "<< Qoutient << endl;
    else if (n==5)
    cout <<"Youve chosen IntegerQoutient, the answer is: "<< IntegerQoutient << endl;
    else if (n==6)
    cout <<"Youve chosen ExponentProduct, the answer is: "<< ExponentProduct << endl;
    else if (n==7)
    cout <<"Youve chosen Squareroot of 1st no, the answer is: " << squareroot1 << endl;
    else if (n==8)
    cout <<"Youve chosen Squareroot of 1st no, the answer is:" << squareroot2 << endl;
    else if (n==9)
    cout <<"Youve chosen Remainder, the answer is:" << remainder <9

  54. /*Create a C++ Program that will input
    two (2) values and will output its:
    -> sum -> exponent product
    -> difference -> square root of the first value
    -> product -> square root of the second value
    -> quotient -> remainder/modulo quotient
    -> integer quotient */
    ——— my answer
    #include
    #include

    using namespace std;

    int main()
    {

    double Number1,Number2,IntegerQoutient;
    double Sum,Difference,Product,Qoutient;
    double ExponentProduct,squareroot1,squareroot2,remainder;

    cout <<"This is a calculator" << endl;

    cout <> Number1;
    cout <> Number2;

    Sum=Number1+Number2;
    Difference=Number1 – Number2;
    Product=Number1 * Number2;
    Qoutient=Number1 / Number2;
    IntegerQoutient=Number1/ Number2;
    ExponentProduct=pow(Number1,Number2);
    squareroot1=sqrt(Number1);
    squareroot2=sqrt(Number2);
    remainder=fmod(Number1,Number2);

    cout <<"OPERATION:" << endl;
    cout < Press 1″ << endl;
    cout < Press 2″ << endl;
    cout < Press 3″ << endl;
    cout < Press 4″ << endl;
    cout < Press 5″ << endl;
    cout < Press 6″ << endl;
    cout < Press 7″ << endl;
    cout < Press 8″ << endl;
    cout < Press 9″ << endl;
    int n;

    cout << "Please choose any from the option above " <> n;

    if (n==1)
    cout <<"Youve chosen Addition, the answer is: "<< Sum << endl;
    else if (n==2)
    cout <<"Youve chosen Subtraction, the answer is: "<< Difference << endl;
    else if (n==3)
    cout <<"Youve chosen Multiplication, the answer is: "<< Product << endl;
    else if (n==4)
    cout <<"Youve chosen Division, the answer is: "<< Qoutient << endl;
    else if (n==5)
    cout <<"Youve chosen IntegerQoutient, the answer is: "<< IntegerQoutient << endl;
    else if (n==6)
    cout <<"Youve chosen ExponentProduct, the answer is: "<< ExponentProduct << endl;
    else if (n==7)
    cout <<"Youve chosen Squareroot of 1st no, the answer is: " << squareroot1 << endl;
    else if (n==8)
    cout <<"Youve chosen Squareroot of 1st no, the answer is:" << squareroot2 << endl;
    else if (n==9)
    cout <<"Youve chosen Remainder, the answer is:" << remainder << endl;

    return 0;
    }

  55. #include
    #include
    main()
    {
    int x,y;
    clrscr();
    printf(“Enter a value for x and y:”);
    scanf(“%d%d”,&x,&y);
    if(x>y)
    printf(“X is greater”);
    else
    printf(“Y is greater”);
    getch();
    }

  56. Thankyou for post!! If- else statement examples still not enough.
    Im not being able to find out what exactly the error is here:
    #include
    void main()
    {
    int numsweet;
    double cost;
    printf(“How many icecream do you want : “);
    scanf(“%f, &numsweet”);
    cost = 12.10 * numsweet;
    if (numsweet > 1000)
    {
    printf(“The store does not have that much icecream in stock!”);
    }
    else
    {
    printf(“You have to pay $%f to the cashier!\n Thankyou!\n”, cost);
    }
    }

    It gives a warning saying says “Possible use of numsweet before definition in funtion main. Plz help! any advice is welcomed.

    1. Your header file declaration is incomplete #include 2.scanf(“%f”,&numsweet); here you didn’t close the conversion or format string with quotes””.

  57. #include
    void main()
    {
    int n,rem;
    clrscr();
    printf(“enter the number”);
    scanf(“%d”,&n);
    rem=n%2
    if(rem==0)
    printf(“the number is even”);
    else
    printf(“the number is odd”);
    getch();
    }

  58. #include
    void main()
    {
    int a=10;
    if(x==10)
    {
    printf(“pop”);
    printf(“rock”);
    }
    else
    printf(“song”);
    printf(“romance”);
    }
    o/p:-pop rock romance

  59. i need you help guys about something, i am trying to use “if and else” commands but it’s not working at all, can someone tell me what i did wrong ?!!!

    #include
    main()
    {
    char name[4] = {”};
    char namem[5] = {”};

    printf(“What is your name ?!\n”);
    scanf(“%s”, &name);

    if(“name==Mark”)
    {
    printf(“Right, Your name is %s\n\n”, &name);
    }

    else {
    printf(“No, your name is Mark”, &namem);
    }

    system(“pause”);
    }

    1. #include //link section
      #include
      void main()
      {
      char name[4]; //local variable declare string type
      char namem[5]=”ANIL”; //declare & initialized string
      clrscr();
      printf(“What is your name ?”);
      scanf(“%s”, name); // input any string in run time

      if(name==”Mark”) // check condition
      {
      printf(“Right, Your name is: %s”,name);
      }

      else
      {
      printf(“No, your name is Mark %s”, namem);
      }
      getch();
      }

    2. can you make a program in this output?

      output
      MODE OF PAYMENT
      [1] CASH 10% DISCOUNT
      [2] TWO-INSTALLMENT 5% INTEREST
      [3] THREE-INSTALLMENT 10% INTEREST

      ENTER YOUR TUITION FEE: 20,000
      CHOOSE MODE OF PAYMENT: 1
      THE AMOUNT OF PAYMENT:18,000

      this is the output plsss. help me

      1. #include
        int main()
        {
        int a,b,c,d,e,f,g,h;
        printf(“Choose Mode of Payment Below\n”);
        printf(“[1] CASH 10 percent DISCOUNT\n”);
        printf(“[2] TWO-INSTALLMENT 5 percent INTEREST\n”);
        printf(“[3] THREE-INSTALLMENT 10 percent INTEREST\n”);
        printf(“\n”);
        printf(“Enter your tuition fee: “);
        scanf(“%d”,&a);
        printf(“Mode of Payment: “);
        scanf(“%d”,&b);
        if(b==1)
        {
        c=a*0.10;
        d=a-c;
        printf(“THE AMOUNT OF PAYMENT: %d”,d);
        }
        else if(b==2)
        {
        e=a*0.05;
        f=a+e;
        printf(“THE AMOUNT OF PAYMENT: %d”,f);
        }
        else if(b==3)
        {
        g=a*0.10;
        h=a+g;
        printf(“THE AMOUNT OF PAYMENT: %d”,h);
        }
        return 0;
        }

  60. The number 153 has interesting property, it equals to the sum of the cubes of its digit, that is 13+53+33=1+125+27=153. Construct a C Program that reads in a positive three integer number and determine if the number satisfy the property or not. Accordingly, display the number with a message “SATISFY THE PROPERTY” or “DOES NOT SATISFY THE PROPERTY”.

    1. #include
      int main()
      {
      int A,a,B,b,num,T;

      printf(“\t Please Enter an Integer you need to check the properties :”);
      scanf(“%d”,&num);

      A=num%10;
      a=num/10;
      B=a%10;
      b=a/10;
      //This is to check the values, in case of confusion//
      printf(“A=%d a=%d B=%d b=%d \n”,A,a,B,b);

      A=A*A*A;
      B=B*B*B;
      b=b*b*b;
      //This is to check the values, in case of confusion//
      printf(“A=%d B=%d b=%d \n”,A,B,b);
      T=A+B=b;
      if(T==num)
      {
      printf(“\t SATISFY THE PROPERTY/n”);
      }
      else
      {
      printf(“\t DOES NOT SATISFY THE PROPERTY /n”);
      }
      return 0;
      }

      Since this is regarding if-else statement you may use this method,but can also reduce the steps by using a for or do-while loop,=)

      1. @hansel
        this number 153 is one of the armstrong numbers..
        an armstrong number is a number whose sum of the cube of the digits is same as that of the number..

        #include
        #include
        void main()
        {
        int r,c1,c2,c3,n,t,num;
        clrscr();
        printf(“\n please enter the 3 digit no.”);
        scanf(“%d”,&n);
        t=n;
        //calculates the cube of last digit
        r=n%10;
        n=n/10;
        c1=r*r*r;
        //calculates the cube of middle digit
        r=n%10;
        n=n/10;
        c2=r*r*r;
        //calculates the cube of first digit
        r=n%10;
        n=n/10;
        c3=r*r*r;
        //sums up the cubes
        num=c1+c2+c3;
        //checking
        if(num==t)
        {
        printf(“\n%d Satisfies the property”,t);
        }
        else
        {
        printf(“\n%d doesnot Satisfies the property”,t);
        }
        getch();
        }

  61. pls help me

    pls create a program that will accept 5 integers and display the lowest integer

    pls use nested if for c++/turbo c

    thanks..

  62. pls create a program that will accept 5 integers and display the highest and the lowest number

    any conditional statement in c++/turbo c

    thanks..

  63. some one please help me on my task, i need to write a program that can read 10 integer and then display the:

    >biggest number
    >smallest number
    >total
    >average

  64. –>> i badly need the answer regarding this program, can you help me:))

    Write a program that complete the users prompt a services of numbers the program must be determine the odd and even number.. prompt by the users ; also sum the odd and even numbers.

  65. write a program that inputs movie and displays his movie according ti following character ;
    s sorrow movie
    r romentic movie
    a action movie
    s scientific movie
    f funny movie

    1. //trying first check this program n plz send comment in [email protected]
      void main()
      {
      char m1[20],m2[20],m3[20],m4[20],m5[20];
      char ch;
      printf(“Enter the five different movies\n\n”);
      scanf(“1 %2s \n %2s \n %2s \n %2s \n %2s”, &m1,&m2,&m3, &m4, &m5);
      clrscr();
      printf(“enter the choice( S,R,A,s,F) TO GET MOVIES”);
      scanf(“%c”,&ch);
      if(ch==’S’)
      printf( ” ur selection is %s”,m1);
      eise if (ch==’R’)
      printf(“ur selection is %s”,m2);
      else if ( ch==’A’)
      printf(“ur selection is %s”,m3);
      else if (ch==’s’)
      printf(” ur selection is %s”,m4);
      else
      printf(” ur selection is %s”,m5)
      getch();
      }

  66. I want to make a program to find out largest and smallest numbers out of 5 numbers using only 10 if statements and 7 printf statements……is there any one who can solve it…please let make it solve quickly its assignment……!!!!

    1. // im trying coo gtm less than 10 if state
      void main()
      {
      int num1,num2,num3,num4,num5,great;
      if (num1>num2 && num>num3 && num1>num4 && num1>num5)
      great=num1;
      else if (num2>num1 && num2 >num3 && num2 >num4 && num2> num5)
      great=num2;
      else if (num3>num1 && num3 >num2 && num3 >num4 && num3 > num5)
      great =num3;
      else if (num4>num1 && num4 >num2 && num4 >num3 && num4>num5)
      great=num4;
      else
      grate=num5;
      /* same opposite to smallest number*/
      printf( “the greatest number is %d”, great);
      getch();
      }

  67. i want to make a program that will ask the user, how much will be the cost in playing in the computer shop per minute. the program will calculate the cost based on the given formula.

    1.) 1 peso every 4mins.
    cost * mins = total payment

    2.) cost * sec. = total payment
    sec. =.25

  68. hi!! i need the answer for this program please. :):)
    Write A Program To Accept The Marks Of Five Subjects And Find The Total And Percentage.
    Description :-
    If Value Of Any Of Five Subjects Is Negative Or Zero Or 100 An Appropriate Error Is To Be Displayed On The Screen And Program Should Terminate.

  69. If(“condition”)
    printf(“Hello”);
    else
    printf(“World”);

    What should be the “condition” if the output is “HelloWorld”.

    1. condition means….num==num2 or num!=num2 like this.but you just use
      if(condition) but you didn’t give any condition.

  70. hi i need heip from u in this program and my question is
    write a program that perform all basic operation of calculator.?
    these re options
    1) add, sub. multiply, divide
    2) using oject and class of iostream and ostream
    # long as data type .
    plz send me thiz program tomorrow itz my assignment and i ll be very grate ful to u for thiz favour thnkz

  71. please, help me task ,
    write a c program input any number b/w 1 to 12 and print month name according to input number.(using if else statement)

    1. if(m==1)
      {
      printf(“\n January”);
      }
      else if(m==2)
      {
      printf(“”\n February);
      }
      else if(m==3)
      {
      printf(“”\n March);
      }
      else if(m==4)
      {
      printf(“”\n April);
      }
      else if(m==5)
      {
      printf(“”\n May);
      }
      else if(m==6)
      {
      printf(“”\n June);
      }
      else if(m==7)
      {
      printf(“”\n Julye);
      }
      else if(m==8)
      {
      printf(“”\n Ogust);
      }
      else if(m==9)
      {
      printf(“”\n September);
      }
      else if(m==10)
      {
      printf(“”\n Octomber);
      }
      else if(m==11)
      {
      printf(“”\n November);
      }
      else if(m==12)
      {
      printf(“”\n December);
      }
      else
      {
      printf(“”\n Invalid selection);
      }

  72. pls help write a program in c-language. the integral of (2t^2 +3t +1) the limit is from 0 to 4.using the trapezoidal rule

  73. include
    main()
    {
    int m;
    cout<>m;
    if(m==0)cout<<"Jan";
    else if(m==o)cout<<"Feb";
    else if(m==o)cout<<"Mar";
    else if(m==o)cout<<"Apr";
    else if(m==o)cout<<"May";
    else if(m==o)cout<<"June";
    else if(m==o)cout<<"July";
    else if(m==o)cout<<"Aug";
    else if(m==o)cout<<"Sept";
    else if(m==o)cout<<"Oct";
    else if(m==o)cout<<"Nov";
    else if(m==o)cout<<"Dec";
    else cout<<"Wrong entry";
    getch();}

    1. include
      main()
      {
      int m;
      coutm;
      if(m==1)cout<<"Jan";
      else if(m==2)cout<<"Feb";
      else if(m==3)cout<<"Mar";
      else if(m==4)cout<<"Apr";
      else if(m==5)cout<<"May";
      else if(m==6)cout<<"June";
      else if(m==7)cout<<"July";
      else if(m==8)cout<<"Aug";
      else if(m==9)cout<<"Sept";
      else if(m==10)cout<<"Oct";
      else if(m==11)cout<<"Nov";
      else if(m==12)cout<<"Dec";
      else cout<<"Wrong entry";
      getch();}

  74. #include
    #include
    void main()
    {
    int x;
    printf(“enter any number between 1 to 12”);
    scanf(“%d”,&x);
    if(x==1)
    {
    printf(“month is jan. %d\n”,x);
    }
    else if(x==2)
    {
    printf(“month is feb%d\n”,x);
    }
    else if(x==3)
    {
    printf(“month is march .%d\n”,x);
    }
    else if(x==4)
    {
    printf(“month is april %d /n”,x);
    }
    else if……………….
    …………………………………….
    ………………..
    ………………………
    …………………………….
    else(x==12)
    {
    printf(“month is december %d\n”);
    }
    getch();
    }

  75. write a c programme to calculate first class, second class, pass class, of student where marks by supplied by user/*………………plz give me ans fast…………..*/

  76. you have to work with three temperature types: Celsius, Fahrenheit and Kelvin. What we are going to do here, people would come to you to ask to convert temperature. They come with three inputs, the temperature which they want to convert, the type of the temperature and the intended type to convert it. As we are dealing with three types of temperature, we represent them 0, 1 and 2 (Celsius = 0, Fahrenheit = 1 and Kelvin = 2). The temperature is a number (floating point). The output is the temperature in the intended type.

  77. how to put if else inside if else?

    #include
    void calculation();
    int main(void)
    {
    int type,no_resistor,resistor1,resistor2,resistor3,voltage,totalr,current;
    printf(“Circuit Calculator V1.0\n”);
    printf(“Structured programming & interfacing\n”);
    printf(“By: Muhammad Al-fateh\n”);
    printf(“Date: 1 NOV 2012\n”);
    printf(“Purpose:This programme will ask user to enter elements of circuit and calculate the total resistance & current value\n\n”);
    printf(“———————————————–\n”);
    printf(“Please choose type of circuit:\n”);
    printf(“1.Series Circuit\n”);
    printf(“2.Parallel Circuit\n”);
    scanf(“%d”,&type);
    if (type == 1)
    {
    printf(“You have choosen Series circuit.\n”);
    printf(“Enter number of resistor (2 or 3 resistor only):”);
    scanf(“%d”,&no_resistor);
    printf(“This is how the circuit look like\n\n”);
    }

    if (no_resistor == 2)
    {
    printf(” +—–===—-===—–+\n”);
    printf(” | R1 R2 |\n”);
    printf(“(v) |\n”);
    printf(” +——————–+\n”);
    calculation();
    }
    else if (no_resistor == 3)
    {
    printf(” +—–===—-===—–+\n”);
    printf(” | R1 R2 |\n”);
    printf(“(v) |\n”);
    printf(” +—-===————-+\n”);
    printf(” R3 \n”);
    calculation();
    }
    else
    {
    printf(“Choose between 2 or 3 ONLY\n”);
    }

    else if (type ==2)
    {
    printf(“You have choosen Parallel circuit.\n”);
    printf(“Enter number of resistor (2 or 3 resistor only):\n”);
    scanf(“%d”,&no_resistor);
    printf(“This is how the circuit look like\n\n”);
    }
    if (no_resistor == 2)
    {
    printf(” +——===—–+\n”);
    printf(” | R1 |\n”);
    printf(” +——===—–+\n”);
    printf(” | R2 |\n”);
    printf(” +——(V)—–+\n”);
    calculation();
    }
    else if (no_resistor == 3)
    {
    printf(” +——===—–+\n”);
    printf(” | R1 |\n”);
    printf(” +——===—–+\n”);
    printf(” | R2 |\n”);
    printf(” +——===—–+\n”);
    printf(” | R3 |\n”);
    printf(” +——(V)—–+\n”);
    calculation();
    }
    else
    {
    printf(“Choose between 2 or 3 ONLY”);
    }
    else
    {
    printf(“Choose between no 1 or no 2 (tips: enter digit only)”);
    }
    return(0);
    }
    void calculation()
    {
    int type,no_resistor,r1,r2,r3,voltage,totalr,current; //r1 = resistor 1 and so on..
    printf(“This program will now calculate the total voltage and current\n”);
    printf(“Please enter voltage value (for battery):”);
    scanf(“%d”,voltage);
    printf(“Please enter resistor value based on diagram given:”);

    if ( type == 1 && no_resistor == 2)
    {
    printf(“Enter value R1 and R2 ( put space between answers)”);
    scanf(“%d %d”,&r1,&r2);
    totalr = r1+ r2;
    current=voltage/totalr;
    printf(“Total resistance = %d and current = %d”,totalr,current);
    }
    else if ( type == 1 && no_resistor == 3)
    {
    printf(“Enter value R1 ,R2 and R3( put space between answers)”);
    scanf(“%d %d %d”,&r1,&r2,&r3);
    totalr = r1+ r2;
    current=voltage/totalr;
    printf(“Total resistance = %d and current = %d”,totalr,current);
    }
    else if (type == 2 && no_resistor == 2)
    {
    printf(“Enter value R1 and R2 ( put space between answers)”);
    scanf(“%d %d”,&r1,&r2);
    totalr = 1/((1/r1)+ (1/r2));
    current=voltage/totalr;
    printf(“Total resistance = %d and current = %d”,totalr,current);
    }
    else if ( type == 2 && no_resistor == 3)
    {
    printf(“Enter value R1 ,R2 and R3( put space between answers)”);
    scanf(“%d %d %d”,&r1,&r2,&r3);
    totalr = 1/((1/r1)+ (1/r2)+(1/r3));
    current=voltage/totalr;
    printf(“Total resistance = %d and current = %d”,totalr,current);
    }
    else
    {
    printf(“null”);
    }
    }

  78. #include
    #include
    main ()
    {
    int x,y;
    scrclr();
    printf(“Enter value for x :”);
    scanf(“%d”,&x);
    printf(“Enter value for y :”);
    scanf(“%d”,&y);
    if ( x>y)
    {
    printf(“X is less-than: %d\n”,x);
    }
    else{
    printf(“Y is greater-than: %d\n”,y);
    }
    getch();
    }

  79. the xyz telegram company charges 18.50 for telegram that do not exceed 12 words and 1.50 pesos for every succeeding word.construct a C program that accepts the number of words in a telegram compute and display the charges.

  80. somebody help me plzz .. so important :D

    the new telephone company has the follwing rate structure for long distance calls:

    a. any call started after 7:00PM (1900hrs) but before 8:00 (0800 hours) is discounted 30%
    b. any call stared after 8:00 am (0800 hours) but before 7:00 (1900 hours) is charged full.
    c. all calls are subjected to 8% tax
    d. the regular rate for a call is P15.00 per minute.
    e. Any call longer than 60 minutes receives a 20% discount on its cost (after any other discount is subtracted but beofre tax is added)

    Instructions:
    1. Write a c program that takes the start time for a call based on a 24-hour clock and the lenght of the call in minutes. the gross cost (before any discounts or tax) should be printed followed by the net cost (after discounts is deducted and tax added).
    2. Design a graphical user interface or GUI that fits to the given problem.
    3. The program will accept multiple user.

  81. guys!! will you help me to create a program that have a switch statement,do while, and if else.. this is can be see in a one program only..!

  82. #include
    int main()
    {
    int x,y;
    printf(“enter value for x=”);
    scanf(“%d”,&x);
    printf(“enter value for y=”);
    if(x>y){
    printf(“x is the greater number=%d\n”,x);
    }
    else{
    printf(“y is the greater number\n”,y);
    }
    return 0;
    }

  83. #include
    #include
    void main()
    {
    int a;
    clrscr();
    printf(“enter the any value”);
    scanf(“%d”,&a);
    if(a==5)
    printf(“A is a greater the”);
    else
    printf(B is a less then);
    getch();
    }

  84. //* hi friends i have a problem with the following program.actualy i used turbo c compiler under dosbox 0.74v when i compile this program then it shows none error.when i run this program then it runs properly but i cant get desired o/p.
    this program is to define wether the driver is insured or not.conditions for insurance are as
    1) if driver is married – then driver is insured.
    2) if driver is unmarried,male and age more than 30 – then driver is insured.
    3) if driver is unmarried,female and age more than 25 – then driver is insured.
    when i enter age-22,sex-f,and marrital status-u
    (i.e.age=22/sex=female/marrital status=unmarried)
    then i get o/p that driver is insured.
    so kindly help me.
    #include
    void main()
    {
    clrscr();
    char ms,sex;
    int age;
    printf(“enter age,sex & marrital status\n”);
    scanf(“%d%c%c”,&age,&sex,&ms);
    if(ms==’m’)
    printf(“driver is insured\n”);
    else
    {
    if(sex==’m’)
    {
    if(age>30)
    printf(“driver is insured\n”)
    else
    printf(“driver is not insured\n”);
    }
    else
    {
    if(age>25)
    printf(“driver is insured\n”);
    else
    printf(“driver is not insured\n”);
    }
    }
    getch();
    }

  85. Prompt the user for a day number then print the name of the day, where 1 = Sunday, 2 = Monday, etc. If the user enters a number other than 1 through 7, print an error message.

    Use If-then/else statement and then do the same for switch statements

  86. write a pgm using logical operation to find out that a person has insurence policy or not
    1) if married
    2)if unmaried – gender-male
    age more than 30 years
    gender- female
    age more than 23 years
    can smone tell me completely.

  87. show the solution at the vedio store new releases rent for 3.00 a night oldies rent 2.00 your sales clerk will enter 1 for new release 2 for oldies to be stored in the variable type OR write the statement s that would increment the appropriate counter variable keeping track of the number of new releases and oldies rented and add the appropriate amount to the variable keeping track of the current sale.

  88. sir .. can you help me.. plss..
    using do/while loop write a program that computes and display the sum of all even positive input numbers. the program terminates if it reads a negative number..

    sample input/ouput dialogue:
    enter a number:1
    enter a number:2
    enter a number:3
    enter a number:4
    enter a number:-4

    the sum of all even number(s) is:6

    now na po.. ^_^

  89. Need help please. Assignment Please answer it. Thank you so much :)

    write a program that computes the grade of a student using the formula:
    grade=40% major exam + 30% ave of 2 long exams + 30% of a short quizzes.
    Display the average of two long exams, average of 3 short quizzes and the grade of the student.display also a message whether the student passed of failed passing is 75%

  90. Prompt the users to enter the subject name and traverse the list of subjects and if the entered subject is in list, display the name of the subjects (English, Math, Science. French). Using only if/switch statements

  91. hy guys i did this program my assigment so i wanna added like when you ask you name i wana printed if it dont know like i dont understand can any one help me pleas
    if you can this is my email [email protected]
    #include

    int main (){
    int UserAsk ;
    int UserName ;
    int UserAge;
    int UserSpeed;
    printf(“sir can i see y license?”);
    scanf(“%”,UserAsk);

    printf(“whats you name?”);
    scanf(“%abdi”,&UserName);

    printf(“how old are you sir”);

    scanf(“%d”,&UserAge);

    if(UserAge=40)

    printf(“Sir Are you drunk?”);
    scanf(“%d” , &UserSpeed);

    //Conditional Statment to Test if the Driver is drunk
    //if the user is not drunk, they are allowed to drive

    if(UserSpeed 70
    printf(“You drive safety speed thnx.”);

    }else{
    //This stuff runs only if the statement evaluates to <70
    printf("sir your speeding,mor then 70 km/h!");
    }
    getchar();
    getchar();

    return 0;
    }

  92. Hotel Seri Malaysia has pointed you to build a room reservation system. The system required total of guest that will be insert by user. Then, the system allowed user to select appropriate rooms. There are 4 types of rooms with different of prizes and capacity. If the total guest balance is 1, the guest will suggested to share the room with others guest. Refer to when that has different prices and the amount of different people. Each room is given different discount value. Please refer to Table 1 for the detail.

    Table 1: Information of available rooms in Hotel Bayu.
    Room types Maximum (persons) Price (peak) Discount given
    Melur 1 150 10% off
    Kenanga 2 250 20% off
    Teratai (studio) 2 300 25% off
    Rafflesia (suite) 3 350 30% off

    Customer is required to pay a deposit of 50% of the actual price.

    Your system should have:
    1. Global declaration of all the variables and functions.
    2. 5 functions: function melur, function kenangan, function teratai, function rafflesia and calculate balance of person.
    3. In each function, you need to calculate the following items:
    a. Number of rooms
    b. Total price before discount
    c. Total price after discount
    d. Amount paid by customer
    e. Amount to be paid
    Below is the example of the formula to be used:
    Example of formula (for room type Kenanga) :
    num_of_rooms = num_of_people/2;
    before_discount = 250*num_of_rooms;
    after_discount = (before_discount-(0.20*before_discount))
    deposit = 0.5*after_discount;
    to_be_paid = after_discount-deposit;

    4. If there is a balance person that not allocated in the rooms, user needs to re-select the room.
    5. System will calculate total amount from the to_be_paid amount.

    Your program must use operators, control statements (for, do while or any equivalent) and at least 4 functions.

  93. Take two number inputs and a arithmetic operator (+,-,*,/,%) as a character input and to the arithmetic operation and give the output. For example, Your output should be like this:

    Enter a number (A) : 3.0
    Enter a number (B) : 8.5
    Enter an operator : *

    A*B= 25.5

  94. i need a help using switch here is the question….
    Create a c program that will accept a value or amount prom peso and convert it based on a given choice of user
    Choice Currency AMOUNT
    1 YEN .50
    2 UAD 40.50
    3 USD 42.50
    4 EURO 62.25

  95. guys can you help me?

    i need an example of if else statement that accept 3 numbers as input the identify the highest,lowest and middle value.

    anyone can help me. please! :(

  96. can u help me to construct C program !!!! this is the question
    The XYZ telegram company charges 18.50 for telegrams do not exceed 12 words and
    1.50 pesos for every succeeding word. Construct a C program that accepts the number of words in a telegram compute and display the charge..

    can u help me about this !!!!! using turbo C

  97. i want to convert numeric value to char valu(as 199).is but i wann to print (one hundered ninty nine) thi output

    plz tell me how this possibale thank you……

  98. #include
    #include
    void main()
    {
    int a;
    while(‘N’)
    {
    printf(“\nEntr Your Marks: “);
    scanf(“%d”,&a);
    if(a>’39’&&a=’33’&&a<='39')

    printf("D\n\n");

    else if(a=’0′)printf(“F”);

    else

    printf(“Wrong Input. please Enter Marks 0 to 100.\n\t\t Thanks”);}
    getch();
    }

  99. [email protected] says:

    Will u pls help me print this output? .:(
    Election Results
    Enter no. of precints: 3
    No. of votes:
    Precint 1: 10
    Precint 2: 13
    Precint 3:15
    Precint with highest votes: 3
    Precint with lowest votes: 1

  100. can you please help me to program . . .
    /*create the program that accepts three numbers and identify the largest, middle and smallest number if the two or three numbers are equal the output will be the two or three number are equal and smaller or larger

  101. 1. Write a C program that asks user to input an amount, then display 5%, 10% and 15% discount of that amount. For example,
    Please input the amount:
    5% Discount =
    10% Discount=
    15% Discount=

  102. use the If else programming, please do program below

    formula BMI = Weight(kg) / [Height(m) x Height (m)]

    Using program control to print below conditions;

    1.If Your BMI Less than 18.5, you are underweight
    2.If Your BMI is 18.5 less than 25, your weight is desirable
    3.If Your BMI is 25 to less than 30, your are overweight
    4.If Your BMI is 30 or more, you are obese

  103. develop a program to print the charges for a person,if he enter his age then program ask the user to enter his age and by using if else structure print the charges,if age is 55 and above it the charges is 10$ if age is 21 to 54 it charges is 15$ if age is 13 to 20 it charges is 8$ if age is 3 to 12 it charges is 5$ if under 3 no charges that will be free.
    plz snd me in cmplete c++ format

  104. how to print as below:
    4 4 4 4
    4 4
    4 4
    4 4 4 4
    when a user enters 7, it will printed:
    7 7 7 7 7 7 7
    7 7
    7 7
    7 7
    7 7
    7 7
    7 7 7 7 7 7 7
    when user enter 2, it will printed:
    2 2
    2 2

    The program should only allow a user to enter an integer from 1 to 9 in which the ‘Invalid integer’ will be displayed and user will be asked to reenter the integer from 1 to 9 again. After the rectangular shape has been printed, user should be asked whether they want to reenter another integer to reprint the other size of rectangular or they want to exit the program.

  105. Hey guys! Can you help me with this?

    Make a C++ program that will ask the user to input an alphabet character then will display the rest of the characters taking user’s input as its initial value.

    Example:
    Enter a small letter: r
    Output: r s t u v w x y

  106. can i do sth like this ====> if (a==xxxx) {printf”you are ok “}
    else { you are not ok}
    where xxxx is a character . plz txt me back cuz i need it now . thnx :)

  107. My Question:
    Call charges:1st minutes are free and 2.25 for each minutes.
    SMS chargers:0.25 per SMS(50 SMSs are free for month).
    Monthly rental is 300.00.
    Government taxes 12.5% of total bill amount.
    Write a suitable C program to calculate total bill(including taxes)when number of minutes and SMSs are given as input.
    Please tell me what’s the wrong with those code.When I run the program it did not work properly.

    int main()
    {
        printf("\t\tDialog Monthly Total Bill Amount-Version-R01\n");
        float x,y,Total1,Total2,Tatol3;
        {
            printf("Number of minute for call:",x);
            printf("Number of SMSs sent:",y);
        }
        if (x>200)
        {
            printf("call charge=(minutes-200)*2.25");
        }
        else
        {
            printf("call charge=0");
        }
        if (y<=50)
        {
            printf("SMS charge=0");
        }
        else
        {
            printf("SMS charge=SMS*0.25");
        }
        printf(Total1=(300+(call charge+SMS charge))*0.125));
        scanf("%f",Total1);
        {
            printf("Total1 is%0.2f",Total1)
        }
        return 0;
    
  108. explain if \else statement with its syntax which logical operation are user in false statement and how explain whith examples.

  109. please give me the solution for this programm

    if(?)
    {
    printf(“Hello”);
    }
    else
    {
    printf(“world”);

    what is the condition for get Output:”Hello World”
    }

  110. please i need help i want to know whats wrong with this my codes
    #include
    #include
    #include

    int main()
    {
    float price = 91;
    float quantity;
    float discount1 = 1 – 0.2;
    float discount2 = 1 – 0.3;
    float discount3 = 1 – 0.4;
    float discount4 = 1 – 0.5;
    float totalcost1 = price * quantity * discount1;
    float totalcost2 = price * quantity * discount2;
    float totalcost3 = price * quantity * discount3;
    float totalcost4 = price * quantity * discount4;

    printf(“\t Micro-world Technologies Discount Sales\n\n “);
    printf(” Please enter the quantity of items sold: \n”);
    scanf(“quantity is: %f\n”, &quantity);

    if(10 >= quantity = quantity = quantity <= 99){
    printf(" Total cost on 40percent discount is = %f\n", totalcost3);
    } else {
    printf(" Total cost on 50percent discount is = %f\n", totalcost4);
    }

    system("pause");
    return 0;
    }

  111. #include
    #include
    #include

    int main()
    {
    float price = 91;
    float quantity;
    float discount1 = 1 – 0.2;
    float discount2 = 1 – 0.3;
    float discount3 = 1 – 0.4;
    float discount4 = 1 – 0.5;
    float totalcost1 = price * quantity * discount1;
    float totalcost2 = price * quantity * discount2;
    float totalcost3 = price * quantity * discount3;
    float totalcost4 = price * quantity * discount4;

    printf(“\t Micro-world Technologies Discount Sales\n\n “);
    printf(” Please enter the quantity of items sold: \n”);
    scanf(“quantity is: %f\n”, &quantity);

    if(10 >= quantity = quantity = quantity <= 99){
    printf(" Total cost on 40percent discount is = %f\n", totalcost3);
    }
    else {
    printf(" Total cost on 50percent discount is = %f\n", totalcost4);
    }

    system("pause");
    return 0;
    }

  112. if input the distance traveled by a taxi in kilometer and then display the taxi fare based on the distance traveled. the flag down rate is $40 and additional $ 3.50 per 300 meters traveled.
    1km=1000meter

  113. 1. Create A program that will accept number between 1-40.
    2. Program will identify whether the number is HIGH or LOW category based from criteria.
    * HIGH —> 21-40
    * LOW —-> 1-20
    3. under low category each number falls on this must be labeled as above 10 or below 10, criteria.
    * ABOVE 10 = 11-20
    * BELOW 10 = 1-10
    4. program display the result.
    5. program close.

    OUTPUT:

    Enter number = 18

    18 is above 10 under low category.

    Enter number = 22

    22 is above 20 under high category.

    pls help me. im using DEV C++ 5.6.2.
    pls HELP me.

  114. Please Help ME!!!!!

    Write a program in c that prompts the user to enter the year and a month of the year and displays the calendar table for the month of that year on the console…

    1. Can i Have a question??
      it can be happen if the state is IF ELSE statement inside has a SWITCH Statement?? it can be possible??

  115. Hello :)
    Please HELP ME! :D

    Create a program that can greet a person, it can repeat the greeting while the answer is yes and exit if no.

    ANSWER PLEASE? :)))

  116. How to run this in c++ by using for loop only?
    Condition
    1.menu -> character
    If choice == “a”
    If choice == “b”
    If choice ==”c”
    2.choices use for loop(output= 1234567…)

    Menu
    a)print 1 to 10
    b)print odd number 1 to 20
    c)print even number between 1 to 20
    d)print hello 20 times

    Enter choice: a??

    Help me please

  117. Please can any one help me write this program?
    Imperial Taxi Services (ITS) serves one-time passengers and regular clients
    (identified by a taxi card). The ITS taxi fares for one-time passengers are calculated as follows:
    1. Minimal fare: $2. This fare covers the distance traveled up to 1000 yards and waiting time (stopping for traffic lights or traffic jams, etc.) of up to 3 minutes.
    2. For every additional 250 yards or part of it: 25 cents.
    3. For every additional 2 minutes of stopping or waiting or part thereof: 20 cents.
    4. One suitcase: 0 change; each additional suitcase: $1.
    5. Night supplement: 25%, effective for journeys between 21.00 and 06.00 O’clock.
    Regular clients are entitled to a 10% discount and are not charged the night supplement.
    A) Provide the pseudo code for the above problem.
    B) Design a normal program for the taxi fare calculation process.
    C) Design a program using appropriate user-defined functions for the taxi fare calculation process.

  118. can anyone help me with this program,please?
    *a program that will accept a non-negative number and able to count how many odd or even numbers inputted by user loop will terminate if the user input negative number.

  119. please , i want the Solution today

    Write your name, student ID at the top of your program inside the comment.
    Write a C program that will ask the user various choices: ((use switch statement))
    Please make your selection:
    (1) for upright sideway triangle
    (2) for upside sideway triangle
    (3) for a triangle (not sideway)
    (4) triangle with letter A in the middle.
    Once a selection is made, ask the user for the height of the triangle.
    then print the requested triangle.
    Finally ask the user if he wants to continue. If yes then repeat the steps above. ((use so-while loop))
    Explanation:
    (1) upright-sideway triangle with height = 5.
    *
    **
    ***
    ****
    *****
    (2) upside sideway triangle with height = 5.
    *****
    ****
    ***
    **
    *
    (3) triangle with height = 5
    *
    ***
    *****
    *******
    *********
    (4) triangle with letter A in the middle with height = 4
    *
    *A*
    *A*A*
    *A*A*A*

  120. Guys need help! pls ans.
    Write a program that displays an equivalent color once an input letter matches its first character. For example b for Blue, r for Red, and so on. Here are the given criteria: (The letters as an input data and the color as output information).

    Letters Color
    ‘B’ or ‘b’ Blue
    ‘R’ or ‘r’ Red
    ‘G’ or ‘g’ Green
    ‘Y’ or ‘y’ Yellow
    Other letters “Unknown Color”

  121. Please help me how to create a program that will add all the positive numbers inputted and all the negatives inputted.

  122. can anybody solve this program i made this program with char. please help ? only one error and two warning is showing in this program.the only error is “misplaced else in main function” and warning is “code has no effect in main function” i am using turbo C++

    #include
    int main()
    {
    char ILL,ch;
    printf (“ARE YOU ILL ?\n”);
    scanf(“%c%c”,&ILL,&ch);

    if( ch ==’y’|| ch ==’Y’);

    printf(” go to the hospital\n”);

    else

    printf(“then do your homework\n”);
    }

  123. can someone point out whats wrong with this code. it does not run and at this point i am terribly frustrated

    
    int main()
    {
        /*Declare Variables*/
        int done = 0;
        float sum = 0;
        char choice;
        float twix = 0.22;
        float hersheys = 0.30;
        float mars bar = 0.20;
        float sneaker bar = 0.25;
        
        printf("================CANDY STORE=================\n");
        printf("==========================================\n\n");
        printf("To buy a [T]wix bar press T(then enter)\n");
        printf("To buy a [H]ershys bar press H(then enter)\n");
        printf("To buy a [M]ars bar press M(then enter)\n");
        printf("To buy a [S]nicker bar press S(then enter)\n");
        printf("To [E]xit system press E (then enter)\n\n");
        
        while(!done)
        {
                    /*User Inputs*/
                    printf("Your choice: ");
                    scanf("%s",&choice);
                    
                    /*Processing*/
                    swith(choice)
                    {
                          case 'T': 
                               sum = sum + twix;
                               break;
                               
                          case 'H': 
                               sum = sum + hershys;
                               break;
                               
                          case 'M': 
                               sum = sum + mars bar;
                               break;
                               
                          case 'S': 
                               sum = sum + snicker bar;
                               break;
                               
                          case 'E': 
                               done = 1\n;
                               break;
                               
                          default:
                                  printf("Invalid Selection\n");
                                  break;
                                  
                     }
        }
    
       /*Output*/
       printf("\nTotal: $%5.25f\n,sum);
       printf("\"Thanks for shopping! Come again!\"");
    
       getchar();
       getchar();
       return 0;
    
    }
    
  124. This code is giving me these errors “expected initializer before ‘printf'” and “names not declared.” this is d code…
    #include
    int main()
    {

    int name;
    char name[]
    printf(“\n Enter the name \n” );
    scanf(“%s”, &name);
    if(name==Laide)
    {
    printf(“\n Score:42 Remark:Fail Position:5th \n”);
    }
    else
    {
    printf(“Pass”);
    }
    printf(“\n Enter the name of a student: \n” );
    scanf(“%s”, &student);
    if(student==Kehinde)
    {
    printf(“\n Score:64 Remark:Pass Position:4th \n “);
    }
    else
    {
    printf(“Fail”);
    }
    printf(” \n Enter the name of a student: \n ” );
    scanf(“%s”, &student);
    if(Name==Femi)
    {
    printf(” \n Score:78 Remark:Pass Position:2nd \n “);
    }
    else
    {
    printf(“Fail”);
    }
    printf(” \n Enter the name of a student: \n ” );
    scanf(“%s”, &student);
    if(name==Femi)
    {
    printf(“\n Score:87 Remark:Pass Position:1st \n “);
    }
    else
    {
    printf(“Fail”);
    }
    printf(“\n Enter the name of a student: \n ” );
    scanf(“%s”, &student);
    if(name==Jumoke)
    {
    printf(” \n Score:69 Remark:Pass Position:2nd \n”);
    }
    else
    {
    printf(“Fail”);
    }
    return 0;
    }

  125. I need a C program for converting the Date format input as 01/01/2015 to the Output date format 1st,January,2015 using switch case only..

  126. I need help from you guys.

    I’m required to write a program to calculate the utility bill.

    its 20 cents for the first 100 unit
    25cents for the next 200 unit
    and 28 cents for every additional unit.
    the number of reading is based on the current meter reading and the previous meter reading.the bill also includes the fixed charge that is rm 35.00.

  127. guys please help! pleasee!!

    *display a menu with 3 items of your choice with prices (ex. burger – 30 pesos, fries – 25 pesos, softdrinks – 15 pesos, etc.)
    *the user will be asked if he wants to add more to his/her order or not.
    *If not, the user will then be notified the summary of his/her orders and the total bill
    *Input the money and compute for the change
    *extra points for error correction (ex. money is less than bill)

    HINT:

    USE GLOBAL VARIABLES, ARRAYS, FUNCTIONS.

    DO NOT USE GOTO STATEMENT

    PUT A BLANK SPACE WHEN SCANNING A CHARACTER ex. scanf(“%c”, &scanchar); —–> scanf(” %c”, &scanchar);

  128. sir/mam can u please give me the syntax of c language for displaying the actual no of years, no of months and no of days when we give the input as the no of days but the program should be in the format of “if else” condition
    e.g. if i give the input like 745 days it must show that 1-year 0-months and 15-days
    please answer me as early as possible on my email.
    thanku……..

  129. Please help me…
    Problem:
    XYZ telegram company charges 18.50 per telegram that do not exceed 12 words and 1.50 for every succeeding word plus 5.00 service charge if type of delivery is special. Write a program that accpets the number of words in a telegram and the type of delivery (“S” for special and “O” for ordinary). The program computers and outputs the telegram cost.

    Thanks for answering
    God bless

  130. hey how can i design a program that accepts if the supply letter is a vowel or consonant and can be able to accept capital or small letter.
    and how can i design a program that identifies whether the input number is even or odd.

  131. “TURBO C”
    Develop a function oriented program that will allow the user to make a choice on what to do to his inputted 4 numbers.
    choice 1 – compute and display the sum of the 4 numbers
    choice 2 – compute and display the average of the 4 numbers
    choice 3 – compute and display the product of the 4 numbers
    choice 4 – compute and display the difference of the highest and the lowest number
    choice 5 – end of program
    Each choice must have its own function. If the user inputted a different number,display an error message.

  132. Can you help me with this?

    Write a program that requires inventory sales each week per month which will only stop if a number less than zero is entered. Then display the average of sales entered. Also display the average per month. (Month is 4 weeks).

    Help plss

  133. [email protected] says:

    Write a C program that determines whether a number input by its user is composite or prime. A number is prime if it is only divisible by itself and 1; otherwise it is composite. Write a function called isPrime that returns either 1 (for prime numbers) or 0 (for composites). This function should use a loop or loops to produce its result. Your main function should also use a loop that:
    ï‚· reads in a number
    ï‚· uses isPrime to determine whether the number is prime or composite (and prints a message indicating
    which result it got)
    ï‚· checks to see if the user wants to continue

  134. Write a complete C program to create a simple calculator. It should prompts a user to enter two real numbers and the operation to perform ( addition, subtraction , multiplication, and division)and display the result. You should use if-else statement.
    can u please solve this

  135. Plz give me answer programe that input a menu
    pres1 add 2number
    press2 multiply 3 number
    press3 add input a numbr and check add and even

  136. \write a program that displays an equivalent color once an input letter matches its first character.
    letters colors
    ‘B’ or ‘b’ Blue
    ‘R’ or ‘r’ Red ‘G’ or ‘g’ Green
    ‘Y’ or ‘y’ Yellow
    others letters unknown colors

  137. a school is implementing deadline Discount payment policy. According to this policy
    every student is entitle to a certain percentage of discount on the tuition
    fees. Moreover the discount is paid based on whether the student is foreign or
    local student. Below are the details for the discounts.

    Tuition fee Foreign student Local student
    800-1000 2% 1%
    1100-1300 3% 2%
    1400-1600 4% 3%
    1700-1900 5% 4%
    2000-2200 6% 5%
    2300-2500 7% 6%
    2600-2800 8% 7%

    As a java programmer write a simple java program that will calculate the discounts, tuition fees after payment of tuition fees.
    Print out student status and tuition fees. Collect status and tuition fee through the keyboard using Scanner.
    pls help me out

  138. hello guys…i need your help for this question…

    1) Implement a program that will let the user enter a character and it will display the ASCII value.

  139. please help me to settle this,,

    1. Write a program to do the followings: (5 marks)
    a. Read the number of students in the class
    b. For each student, read the weight and sum up the weights for all students
    c. Display the total weight of the student.

    TIPS: USING LOOP FUNCTION (FOR / WHILE..DO)

  140. plsss help..
    write a program that display inputed age if >=60 you are qualified senior citizen and avail 20% discount or else you are not qualified too young.?

  141. write a program to accept 2 numbers and tell whether the product of the two numbers is greater than or equal to 1000? (in c program)

  142. ADDI, is one of the courier company that provide express service in delivering goods to customers. The tariff are based on total weight and delivery destination. Table below shows the pricelist.
    Table 1 : Weight
    Total Weight Price per kg

    1st kilogram 15.00

    The next 4kg ( 2-5kg) 13.00

    The next 20kg (6-25 kg) RM 11.00

    More than 25 kg RM 10.00

    Table 2 : Destination
    Destination Rate
    Within a state
    i. 1-25km
    i. RM 5
    ii. More than 25 km ii. RM 15
    Domestic RM 30

    For express delivery (within 1 day delivery), extra RM 25.00 is add.
    You are required to write a program that will help customer to calculate the tariff based on information given. Your program shall display:
    • Type of goods – documents or parcel
    • Quantity
    • Total weight
    • Destination
    • And delivery type – normal or express
    • Total price to be paid

  143. hii can you help me i need a program that will display the output of the receipt and i need to input my own barcode .. how to do this? help me pls…

  144. sol;;;;
    Q1..Write a program that input numbers from the user until user press “E”. Program should display total number of positive and negative numbers entered. ??
    Q2..Using Switch statement, write a program that displays the following menu for the food items available to take order from the customer:
    • B= Burger
    • F= French Fries
    • P= Pizza
    • S= Sandwiches
    The program inputs the type of food and quantity. It finally displays the total charges for the order according to following criteria:
    • Burger = Rs. 200
    • French Fries= Rs. 50
    • Pizza= Rs. 500
    • Sandwiches= Rs. 150

  145. Q1. Write a C program that allows a user to choose an option to be performed from the options given, that is, area of a circle, surface area of a closed cylinder, area of a sphere, volume of a sphere and atmospheric pressure.
    Depending on the option given, the program prompts the user for the required parameters, performs the calculation and returns the answer.

  146. please help me in this Program takes employee information and checking the conditions then print a message to show if this employee is accept or not (the information , male . above 25years , and bachelor’s degree D)
    please as soon as Plz

  147. #include
    #include
    void main()
    {
    int number;
    printf(“enter any number”);
    scanf(“%d”,& number);
    if(number>0)
    printf(“positive number”);
    else
    printf(“negative number”);
    getch();
    }

  148. Create a C Program that requests the user to enter a value for the final grade of a student. Your program should be able to print out comments based on the entered final grade. (30 points)

    0-40 Read More

    41-60 Please Try Harder

    61-75 Average Student

    76-85 Excellent

    86-100 Outstanding

  149. Develop an algorithm to assist a clerk in determining some statistics about students. For each student, she enters the name, gender (M or F), age and marital status (M or S). She wants to determine the number of married men, married women, single women and eligible bachelors (single men over 25). Each time she has completed entry of data for a student, the algorithm should give her a chance to indicate whether she has entered the data for all of the students.

    please help me

  150. I need help with this assignment:Write an application that accepts information for one product from the user. Your application should be user-friendly and provide clear prompts to the user. The user should enter product ID, product name, and product price. After the user has entered all three values, the application should display this information to the user. This allows the user to verify the information entered. The product information should display in an easy-to-read format using the appropriate combination of printf(), print() and println() statements. Headers or labels should be used in the display to make it clear what each value displayed represents.

    Your code should be well commented.

    Before you write your Java code, start your design by using pseudocode to outline your algorithm. Submit this algorithm in a Word document, and upload this with your zipped NetBeans project. This document will be the beginning of your design document for your application.

    .

  151. Write a program that does the following:
    i. Prompts a user to input five different amount of money in US Dollars ($). NB: Users may enter amount in decimals
    ii. Print out the five amount entered.
    iii. Sum up the total amount entered
    iv. Print the average of the amount entered.

  152. code of this..if-else statement

    accept two integers, If the integers are equal, print the sum of the integers otherwise print the product..
    thank you!!

  153. write a program to calculate an electricity bill.the rate of electricity bill are:
    1.if unit consumed are equal or less than 300 then cos is rs 3 per unit.
    2.if unit consumed greater than 300,the cost of rs 3.5per unit and surcharge of 5% of bill added

  154. Write a C++ program that take two numbers from user, min and max. Use do-while to
    make sure that the user enters the smaller value first. Then your program will compute the sum of all integer numbers from min to max. Use do While loop.

  155. Can someody help newbie
    how to create simple c++ that output below:
    Enter a number X:
    10
    Enter a number Y:
    5
    Bigger number is=10
    Smaller number is=5 Thanks!

  156. Any one say me the coding in c programming
    For output
    Press 1 displayed introduction of linux
    Press 2 displayed introduction of Python
    Press 3 displayed introduction of c programming

    Send me soon if possible
    Thank

  157. Write a program that finds the next day’s date, given any date. The input and output dates shall be in the format dd/mm/yyyy. Assume the user inputs a valid date.

Leave a Comment