Question
Write a C++ program that inputs an integer and passes it to a function. The function should return the number of digits in the integer.
Write a C++ program that inputs an integer and passes it to a function. The function should return the number of digits in the integer. For example, if the integer is 35 the function should return 2, if it is 3572 the function should return 4.
Q2) Write a C++ program to use two functions Large() and Sum(). The Large() function gets two integer arguments by reference and sets the larger number to its square. The Sum() function gets an integer argument by value and returns the sum of the individual digits of the number. The main() function inputs two integers from the user and prints the sum of individual digits and square of a larger number
Step by Step Solution
3.45 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
Ans A include using namspace std int cntint num int count0 whilenum num10 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Java Concepts Late Objects
Authors: Cay S. Horstmann
3rd Edition
1119186714, 978-1119186717
Students also viewed these Computer Engineering questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App