Palindromic Numbers
A palindromic number is a positive integer that reads the same forward as backward. For example, the numbers 1, 11, and 121 are palindromic. Moreover, 1 and 11 are very special palindromic numbers: their squares are also palindromic. How many positive integers less than 10,000 have this property? Write a
The beginning part of your output should look like this:
1 has square 1
2 has square 4
3 has square 9
11 has square 121
22 has square 484
Hint: If str is a string object, the reverse () function (declared in <
reverse(str.begin(), str.end());
Want to see the full answer?
Check out a sample textbook solutionChapter 12 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Problem Solving with C++ (10th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- For Loop Code in Java (more details in the pic below)arrow_forwardThe GCD (Greatest Common Divisor) of two numbers is the largest positive integer number that divides both the numbers without leaving any remainder. Write a program that prompts the user to enter two positive integers and computes their GCD. For example. GCD of 30 and 45 is 15. Sample Run 1: Enter two integers: 30 45 GCD of 30 and 45 is 15 Sample Run 2: Enter two integers: 55 121 GCD of 55 and 121 is 11arrow_forwardQuestion # 1 Initialize a string of size 40. Write a program that prints all unique alphabets from string. After printing them sort them in ascending order. For example: Hi world I am here to help you. Unique characters are: H, I, W, O, R, L, D, A, M, E, T, P, Y, U. Sorted: A, D, E, H, I , L,M, O, P, R, T, U, W, Yarrow_forward
- QuadraticAA.java Write a program that solves quadratic equations of the form , where The values A, B, and C will be real numbers (doubles) that you will request from the user. The equation below is what is used to solve for . Remember, there will be two solutions for x (not necessarily distinct). No loops are necessary, so don’t include any. To find the two solutions for this equation, you will use the quadratic formula: Remember that it must be solved for both the and : You will ask the user to input a value for A, B, and C (in that order, using those same letters), then you will use those values to find the two values of x as above. Your output MUST then display the original quadratic equation back to the user with their coefficients in place, and then output the two results. We will assume that the user will not put zero for A. *Format ALL OUTPUT VALUES (including the equation) to have only two decimal places. There is a test case below. Your program should run the…arrow_forwardpython Geography Grades 2Make a copy of your program for the problem Geography Grades 1 and change the code in such a way that your program nolonger prints the average grade, but the final grade.The final grade is calculated by rounding the average grade to the nearest multiple of a half. So, for example, a 7.2becomes a 7.0 and 7.3 becomes a 7.5. If this calculation results in a 5.5, the final grade becomes a 6.0.Your assignment is to make the report for the geography course of group 2b, that, with the same example input as forthe problem Geography Grades 1, should look like this:Report for group 2bAnne Adema has a final grade of 6.0Bea de Bruin has a final grade of 7.0Chris Cohen has a final grade of 7.5Dirk Dirksen has a final grade of 4.5End of report"""arrow_forwardcapCount.py make a program called capCount.py that has a function that takes in a string and prints the number of capital letters in the first line, then prints the sum of their indices in the second line. The string "hEllo, World" would should look like this: 28arrow_forward
- Basic Computer Programming ActivityLanguage: CShow the code and how it works thanksarrow_forwardUsing python, please explain 1: A positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. A positive integer greater than 1 is composite if it is not prime. Write a program that asks the user to enter an integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered The program should work as follows: Once the user has entered a number, the program should populate a list with all of the integers from 2 up through the value entered. The program should then use a loop to step through the list. The loop should pass each element to a function that displays the element whether it is a prime number.arrow_forwardA contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes in word pairs that consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Ex: If the input is: Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is: 867-5309 LAB 6.21.1: LAB: Contact list 0/ 10 ACTIVITY main.py Load default template... 1 user_input = input() 2 entries = user_input.split() 3 contact_list = dict(pair. split(':') for pair in entries)arrow_forward
- Basic Computer Programming ActivityLanguage: CShow the code and how it works thanksarrow_forwardTAKE A LIST OF STRING FROM THE USER AND COUNT THE NUMBER OF UNIQUE ELEMENTS WITHOUT USING THE FOR, WHILE, Do-WHILE LOOPS. PREFERRED PROGRAMMING LANGUAGE: JAVA/C++arrow_forwardlanguage using - Javaarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning