Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming Problem 1 Write a program that inputs a 5-digit integer from the key

ID: 3762519 • Letter: P

Question

Programming Problem 1

Write a program that inputs a 5-digit integer from the keyboard and prints if the input number is a palindrome or not. A palindrome is a number which has the same digit from either end.

Examples:
12921 is a palindrome.
12923 is not a palindrome.

Programming Problem 2

For this problem, follow the instructions for Program #5 in Chapter 5 Exercises of your textbook. Keep the following points in mind:

A. Write an application that displays a menu of three items for the Jivin’ Java CoffeeShop as follows:

(1) American      1.99

(2) Espresso       2.50

                             (3) Latte               2.15

Prompt the user to choose an item using the number (1, 2, or 3) that corresponds to the item, or to enter 0 to quit the application. After the user makes the first selection, if the choice is 0, display a total bill of $0. Otherwise, display the menu again. The user should respond to this prompt with another item number to order or 0 to quit. If the user types 0, display the cost of the single requested item. If the user types 1, 2, or 3, add the cost of the second item to the first, and then display the menu a third time. If the user types 0 to quit, display the total cost of the two items; otherwise, display the total for all three selections. Save the file as Coffee.java.


Please submit the source code for your program along with a word document that includes screen shots of the compiled results and executed output. The page margins on the top, bottom, left side, and right side should be 1 inch each.

Submit the source code along with the Word document to the appropriate dropbox. See the Course Calendar for due dates. You will be penalized for late submission.

Evaluation Criteria

Review the SBT Individual Programming Rubric located in the "Start Here" section of the course for more information on grading criteria. Keep the following points in mind:

The source code, compiled result, and executed output of each program are correctly stated.

I need the text and photos to show it was executed properly!

Explanation / Answer

#include <stdio.h>

#include<string.h>

int main() {

char s1[20];

int i, j, len=0, flag=0;

printf(" Enter any string: ");

gets(s1);

for (i=0; s1[i]!=''; i++)

len++; i = 0;

j = len-1;

while (i < len)

{

if (s1[i] != s1[j])

{

flag = 1;

break;

}

i++;

j--;

}

if (flag == 0)

printf(" String is palindrome");

else

printf(" String is not palindrome");

getch();

}