Sign In
Ask Question
Ellis Haas
Computers & Technology
13 July, 04:53
Program on automorphic number
+5
Answers (
1
)
Zion Woodard
13 July, 05:08
0
The program to this question can be given as:
Program:
#include//header file.
using namespace std; / /using name namespace
void number (int n) / /define function
{
int temp, s, c=1; / /define variable.
temp=n; / /holding value in temp variable.
s=n*n; / / calculate square.
while (n!=0) / /loop
{
//calculating value.
c=c*10;
n=n/10;
}
if (s%c==temp) / /if block
{
cout<<"Automorphic Number"; / /print message.
}
else / /else block
{
cout<<"Not Automorphic Number"; / /print message.
}
}
int main () / /main method
{
int n; / /define variable n.
cout<<"Enter a number : "; / /message
cin>> n; / /input value.
number (n); / /calling function.
return 0;
}
Output:
Enter a number : 5
Automorphic Number
Explanation:
An Automorphic number is a value in which the square end has the same numbers as a number itself. The explanation of the above program as follows:
In the above automorphic number program, we define a function that is "number () " in the function, we pass variable n that is integer. Inside a function, we define a variable that is "temp, s, and c". The temp variable is used to for copy the number, s, and c variable is used for calculating the automorphic number. In the function, we define a loop that is "while loop" it entry control loop, in loop we define a conditional statement that checks that the calculated value which holds variable s and temp value is equal or not if condition is true, it will print "Automorphic Number" else it will print "Not Automorphic Number". Then we define the main method in the method we define a variable n and take value-form user and pass value to function then we call the function.
Comment
Complaint
Link
Know the Answer?
Answer
Not Sure About the Answer?
Find an answer to your question 👍
“Program on automorphic number ...”
in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers
You Might be Interested in
Which of woolner's (1995 five stages to becoming a learning organization applies primarily to start-ups?
Answers (1)
Dir, attrib, cd, and rem are all examples of:
Answers (1)
Which of the following is a poor listening behavior? responding with a nod or saying "uh-huh" mentally summarizing the speaker's details giving advice to the speaker allowing a natural pause when the speaker is finished
Answers (1)
What tab group would you use to change the format of cell A2 to match cell A3?
Answers (1)
Which of the following is the easiest way for visitors to learn about a business while visiting a website?
Answers (1)
New Questions in Computers & Technology
1. How is Cyber Bullying different from bullying in person? 2. What could you do about stopping Cyber Bullying?
Answers (2)
What two variables does mass depend on?
Answers (1)
How many times does the following loop body execute? int count = 52; for (int i = 0; i < count; i++) {cout << count << endl; --count; } 26 52 25 None of the above
Answers (1)
On Windows computers, applications from Microsoft will not look and act the same as windows and menus from the operating system. True False
Answers (2)
What is the purpose of lookup tables in spreadsheet software? A. They allow the user to retrieve information from another location in a table. B. They allow the user to lock cells that contain information that remains consistent. C.
Answers (1)
Home
»
Computers & Technology
» Program on automorphic number
Sign In
Sign Up
Forgot Password?