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++ MPL
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)
- python 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_forwardComputer Engineering labarrow_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_forwardPart 3: Negative Binary Numbers This standard method of binary number representation doesn't account for negative numbers. We can't just throw a negative sign in front of a binary number though - everything in a computer must be represented by 1's and 0's. One way we can get around this is by using the very first digit of each binary number to represent the sign: 0 for positive and 1 for negative. This is called 1's complement representation. 00010110 -> 0 0010110 -> positive 22 10010110 -> 1 0010110 -> negative 22 Using 1's complement representation we can represent the numbers -127 through 127 in a single byte (note that we can only go half as high as an unsigned number because half of the possible representations for that byte are being used for the negative numbers). However, there is a flaw with 1's complement: the representation of the number 0. 00000000 -> 0 0000000 -> zero 10000000 -> 1 0000000 -> negative zero? Because of this, we…arrow_forward
- language using - Javaarrow_forwardPrimeAA.java Write a program that will tell a user if their number is prime or not. Your code will need to run in a loop (possibly many loops) so that the user can continue to check numbers. A prime is a number that is only divisible by itself and the number 1. This means your code should loop through each value between 1 and the number entered to see if it’s a divisor. If you only check for a small handful of numbers (such as 2, 3, and 5), you will lose most of the credit for this project. Include a try/catch to catch input mismatches and include a custom exception to catch negative values. If the user enters 0, the program should end. Not only will you tell the user if their number is prime or not, you must also print the divisors to the screen (if they exist) on the same line as shown below AND give a count of how many divisors there are. See examples below. Your program should run the test case exactly as it appears below, and should work on any other case in general. Output…arrow_forwardProgramming language: JAVA Write a piece of code to generate 100 random characters (10 rows of 10 characters) and display them on the screen. -In a loop, generate a random number between 1 to 255 by using Math.random(). Use this number as an ASCII code for a character char c and then print c.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning