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
Does You tube have a You tube channel? and does Netflix have to pay for their own account?
Answers (2)
The blank contains the most commonly used commands
Answers (1)
Some computer engineering students decided to revise the LC-3 for their senior project. In designing the LC-4, they decided to conserve on device registers by combining the KBSR and the DSR into one status register: the IOSR (the input/output status
Answers (1)
What is a wide area network (WAN) ?
Answers (2)
Write a method that checks whether the input string or a sentence (a string with spaces) is a palindrome or not. The method should be case insensitive and should ignore spaces.
Answers (1)
New Questions in Computers & Technology
Write the definition of a function reverse, whose first parameter is an array of integers and whose second parameter is the number of elements in the array. The function reverses the elements of the array. The function does not return a value.
Answers (1)
Which is a real-world example of a procedure?
Answers (1)
When compared to traditional desktop customers, why are mobile phone users much more likely to book a room or airline reservation for the same day?
Answers (1)
What does OMR mean in information technology
Answers (1)
What is the synonym for term port?
Answers (1)
Home
»
Computers & Technology
» Program on automorphic number
Sign In
Sign Up
Forgot Password?