+ Back to Home 3. 2 Raise to x (with Boilerplates) by Catherine Arellano Your friend asked you to help her determine the value of 2 raise to x where x is a digit in a positive integer. Inputs are the number and position of the digit.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
E Back to Home
Time Left: 01:01:41
Overall Score: 0/40
main.c
digitPos.h
3. 2 Raise to x (with Boilerplates)
by Catherine Arellano
1
#include<stdio.h>
#include"digitPos.h"
int main(void) {
Your friend asked you to help her determine the value of 2 raise
to x where x is a digit in a positive integer. Inputs are the number
and position of the digit.
3
getNum );
getPos();
int digit = determineDigit(num,pos);
raiseTo(digit);
int num =
5
int pos =
%3D
Example:
The given number is 1234.
int n =
display(n);
return 0;
}
Position is 2.
9.
Position starts from right to left. The digit in position tis 4,
position 2 is 3, position 3 is 2 and position 4 is 1.
So, 23 is 8.
You are required to implement the following functions:
10
int getNum();
/*asks and returns number from the user.*/
int getPos();
*asks and returns digit position*/
int determineDigit(int num, int pos);
*returns the digit in the pos position*/
int raiseTo(int digit);
/*returns 2dlgite /
void display(int n);
*display the output*/
You are not allowed to edit main.c and digitPos.h.
Input
Score: 0/15
EOvervlew
3/3
Transcribed Image Text:E Back to Home Time Left: 01:01:41 Overall Score: 0/40 main.c digitPos.h 3. 2 Raise to x (with Boilerplates) by Catherine Arellano 1 #include<stdio.h> #include"digitPos.h" int main(void) { Your friend asked you to help her determine the value of 2 raise to x where x is a digit in a positive integer. Inputs are the number and position of the digit. 3 getNum ); getPos(); int digit = determineDigit(num,pos); raiseTo(digit); int num = 5 int pos = %3D Example: The given number is 1234. int n = display(n); return 0; } Position is 2. 9. Position starts from right to left. The digit in position tis 4, position 2 is 3, position 3 is 2 and position 4 is 1. So, 23 is 8. You are required to implement the following functions: 10 int getNum(); /*asks and returns number from the user.*/ int getPos(); *asks and returns digit position*/ int determineDigit(int num, int pos); *returns the digit in the pos position*/ int raiseTo(int digit); /*returns 2dlgite / void display(int n); *display the output*/ You are not allowed to edit main.c and digitPos.h. Input Score: 0/15 EOvervlew 3/3
Time Left: 01:01:14
Overall Score: O/40
Current Rank: 1st
Layout:
Side-b
main.c
digitPos.h X
< > + c
Test Cases
Executions
int getNum();
asks and returns number from the user.*/
CE Run Tests
4.
int getPos();
/ *asks and returns digit position*/
6.
O Test Case 1
int determineDigit(int num, int pos);
/ *returns the digit in the pos position*/
7
8.
Your Output
9.
No Output
int raiseTo(int digit);
/*returns 2digit*/
10
11
12
Expected Output
void display(int n);
/*display the output*/
13
14
Enter the number: 1234
Enter the digit position: 2
2 raise to digit position = 8
O Test Case 2
O Test Case 3
O Test Case 4 Hidden
O Test Case 5 Hidden
Execute Code (F10
123 45
Transcribed Image Text:Time Left: 01:01:14 Overall Score: O/40 Current Rank: 1st Layout: Side-b main.c digitPos.h X < > + c Test Cases Executions int getNum(); asks and returns number from the user.*/ CE Run Tests 4. int getPos(); / *asks and returns digit position*/ 6. O Test Case 1 int determineDigit(int num, int pos); / *returns the digit in the pos position*/ 7 8. Your Output 9. No Output int raiseTo(int digit); /*returns 2digit*/ 10 11 12 Expected Output void display(int n); /*display the output*/ 13 14 Enter the number: 1234 Enter the digit position: 2 2 raise to digit position = 8 O Test Case 2 O Test Case 3 O Test Case 4 Hidden O Test Case 5 Hidden Execute Code (F10 123 45
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
InputStream
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education