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
The instructions your computer uses when you turn on the power are stored in rom and are referred to as
Answers (1)
How can chess computers be programmed so that it can be so accurately adjusted to a skill level ranging from a beginner to a grandmaster?
Answers (1)
When parking uphill on a street with no curb how should your front wheels be positioned
Answers (1)
Provide a few examples of how cryptography actually secures data.
Answers (1)
What is the purpose of an arraignment?
Answers (2)
New Questions in Computers & Technology
Arrange the following storage media in descending order of storage capacity:Zip disk, a standard floppy disk, a compact disc, 123, 321,132, 312
Answers (1)
Jacob wants to be a Steamfitter. He just finished his associate's degree. Which best describes what he should do next? A. Get a bachelor's degree. B. Do a three - to five-year apprenticeship. C. Get a master's degree. D.
Answers (2)
what is the difference between a packet filtering firewall and a dynamic stateful inspection firewall?
Answers (1)
What is another name for maize?
Answers (1)
Maintain a distance of at least between your vehicle and the vehicle behind you. A. 2 seconds B. 3 seconds C. 4 seconds D. 5 seconds
Answers (1)
Home
»
Computers & Technology
» Program on automorphic number
Sign In
Sign Up
Forgot Password?