Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in C. I am only given one hour to code this. [NOTE : NO arrays, pointers, recursion and strings should be used in this

image text in transcribed

image text in transcribed

Code in C. I am only given one hour to code this. [NOTE : NO arrays, pointers, recursion and strings should be used in this code.] 1) How do I go about doing this is under an hour? Please include some thought processes.

Task 2: 'Seesoo' and Teetoo' Values (70 marks Task Statement Given a positive integer n, which can be a very big number so you are to use the type long long (see more information in the box below), find its 'seesoo value and 'teetoo' value The long long type allows you to use integers in a bigger range of values. In sunfire, the long long type takes 8 bytes, hence it can represent integers in the range trom -2 through 21, or 1-9223372036854775808, +9223372036854775807 The format specifier for long long type in scanti) and print() is %li Seesoo' value The seesoo value is obtained by summing up all the digits in n. If the sum contains more than one digit, you are to sum up all the digits in it again, and repeat this process until eventually the sum contains a single digit, which is the 'seeso value of n. For example, if n s 123456789012345678, then its 'seesoo value is 9 (1+2+3+4+5+6+7+8+9+0+1+2+3+4+5+6+7+8-81,8 + 1 9). If n is 999777555333111, then its 'seesoo, value is 3 (9+9+9+7+7+7+5+5+5+3+3+3+1+1+1 = 75,7+5 = 12:1+2 = 3). You must write a function to compute the 'seesoo value. Your algorithm should be a general one that works on any arbitrarily large positive integer Those who know Number Theory or who have taken CS1231 might be aware that the solution can be obtained by this algorithm: Algorithm seesoo(num) I answer = num%9; if {answer =0) return 9; else returm answer However, for this PE, you are not to use the above algorithm. You are to use repetition statement to solve this task. Teetoo' value The 'teetoo value of a number n is obtained by splitting n into groups of width 3 from left to right, with one digit separating two neighbouring groups, and finding the sum of these groups For example, if the given positive integer n is 123456789012345678, then n can be split into groups of width 3 fram left to right as follows: 123 4 567 8 901 23456 78 Note thatteast t group may have fewer than 3 digit:s The sum of these groups is 123 + 567 + 901 + 345 + 78-2014. Hence 2014 is its 'teetoo' value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

6. Effectively perform the managers role in career management.

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago