What is the output of the following program? int getFirstDigit(int - ProProfs Discuss
Advertisement

What is the output of the following program? int getFirstDigit(int value) {return value/10;}int getLastDigit(int value {return value % 10;} int main(int argc, char *argv[]) {int x; int first; int second; x = 42; first = getFirstDigit(x); second = getSecondDigit(x); cout << second; cout << first;}



Asked by Dawit, Last updated: Apr 21, 2024

+ Answer
Request
Question menu
Vote up Vote down 1

3 Answers

Dawit

Dawit

Dawit
Dawit

Answered Jun 19, 2018

Second = getSecondDigit(x) calls a function which doesn't exist.

upvote downvote
Reply 

f.Brian

f.Brian

f.Brian
F.Brian

Answered Jan 28, 2018

C++ is a common type of computer programming language. C++ is known as a general-purpose object oriented programming language. It was developed by Bjarne Stroustrup as an extension of the already established C language.

As an example of the language the following formula for a program has an output of 24: int getFirstDigit(int value) { return value/10;}int getLastDigit(int value) { return value % 10;} int main(int argc, char *argv[]) { int x; int first; int second; x = 42; first = getFirstDigit(x); second = getSecondDigit(x); cout << second; cout << first;}. Although it can be easy to learn if you have the background needed to learn C++ it is not suitable as a first programming language to learn. One should start with C and build knowledge from there.

upvote downvote
Reply 

John Smith

John Smith

John Smith
John Smith

Answered Oct 24, 2016

24
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.