C program for Osiris numbers with 3 digits?
Here we will see the Osiris. The number of Osiris is a number that is equal to the sum of permutations of subsamples of its own number. Suppose this number is 132, then if we calculate {12 21 13 31 23 32}, this is also 132. So this number is the number of Osiris. We have to check if the given number is the number of Osiris.
The method is very simple. If we analyze these numbers, each number appears twice, so they are in the ones and tens places. So we can check that by multiplying them by 11.
Algorithm
isOsirisNumber(n) -
Begin a := last digit b := second digit c := first digit digit_sum := a + b + c if n = (22 * digit_sum), then return true end if return false End
Example
#include using namespace std; bool isOsirisNumber(int n) { int a = n % 10; int b = (n / 10) % 10; int c = n / 100; int sum = a + b + c; if (n == (22 * sum)) { return true; } return false; } int main() { int n = 132; if (isOsirisNumber(n)) cout << "This is Osiris number"; else cout << "This is Not Osiris number"; }
Output
This is Osiris number
The above is the detailed content of C program for Osiris numbers with 3 digits?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The rename function changes a file or directory from its old name to its new name. This operation is similar to the move operation. So we can also use this rename function to move files. This function exists in the stdio.h library header file. The syntax of the rename function is as follows: intrename(constchar*oldname,constchar*newname); The function of the rename() function accepts two parameters. One is oldname and the other is newname. Both parameters are pointers to constant characters that define the old and new names of the file. Returns zero if the file was renamed successfully; otherwise, returns a nonzero integer. During a rename operation

Hyperbolic functions are defined using hyperbolas instead of circles and are equivalent to ordinary trigonometric functions. It returns the ratio parameter in the hyperbolic sine function from the supplied angle in radians. But do the opposite, or in other words. If we want to calculate an angle from a hyperbolic sine, we need an inverse hyperbolic trigonometric operation like the hyperbolic inverse sine operation. This course will demonstrate how to use the hyperbolic inverse sine (asinh) function in C++ to calculate angles using the hyperbolic sine value in radians. The hyperbolic arcsine operation follows the following formula -$$\mathrm{sinh^{-1}x\:=\:In(x\:+\:\sqrt{x^2\:+\:1})}, Where\:In\:is\:natural logarithm\:(log_e\:k)

The problem implements Euclidean's algorithm to find the greatest common divisor (GCD) and least common multiple (LCM) of two integers and outputs the results with a given integer. Solution The solution to implement Euclidean algorithm to find the greatest common divisor (GCD) and least common multiple (LCM) of two integers is as follows - the logic of finding GCD and LCM is as follows - if (firstno*secondno!=0){ gcd= gcd_rec(firstno,secondno); printf("TheGCDof%dand%dis%d",

On May 7, our mobile phone manufacturer officially announced that our company’s GTNeo6 launch conference is scheduled for May 9. GTNoe6 is positioned as a "performance storm", aiming to stir up the mid-range machine situation. In addition, this conference will also be the first AI digital human conference in the mobile phone industry. At that time, Realme Vice President, Global Marketing President, and China President Xu Qi will appear at the press conference in the form of a digital human. Digital man Xu Qi According to the official introduction, Realme GTNoe6, codenamed "Hurricane", is faster and stronger. It will challenge the strongest third-generation Snapdragon 8s flagship and the strongest product in its class. Recently, the Realme GTNeo6 was found to be directly on the e-commerce platform. Some core configurations were exposed, showing that the machine is not only equipped with a Snapdragon 8s processor, but also supports 120W flash charging.

The given date format is day, month and year (integer). The task is to determine if that date is feasible. Valid date range should be 1/1/1800–31/12/9999, dates outside these dates are invalid. These dates include not only the year range, but also all constraints related to calendar dates. The constraints are - the date cannot be less than 1 and greater than 31. The month cannot be less than 1 and greater than 12. The year cannot be less than 1800 and greater than 9999. When the month is April, June, September, or November, the date cannot exceed 30. When the month is February, we have to check if, if the year is a leap year then the number of days cannot exceed 29 days otherwise the number of days cannot exceed 28 days. li>If all constraints are true, then it is a valid date, else it is not

PHP is a popular server-side scripting language that is widely used to develop web applications. In web development, we often encounter situations where we need to determine the number of digits in a number. This article will introduce the method and application of PHP to determine the number of digits in a number, and provide specific code examples. 1. Methods for judging the number of digits in a number. In PHP, judging the number of digits in a number can be achieved through a variety of methods. The following are some commonly used methods: Use the built-in function strlen(): you can directly convert the number into a string, and then Use strlen() function

Pattern Matching in C - We have to find if a string exists in another string, for example, the string "algorithm" exists in the string "naivealgorithm". If it is found, then its location (i.e. where it is located) is displayed. We tend to create a function that takes an array of 2 characters and returns the position if it matches -1 otherwise. Input:txt="HEREISANICECAP" pattern="NICE"Output:Patternfoundatindex10Input:tx

How to convert strings to numbers in Golang In Golang, we often need to convert strings to numbers to perform some calculation operations. The process of converting strings to numbers is relatively simple and mainly relies on the strconv package in the Golang standard library. This article will introduce in detail how to use the strconv package to convert strings to numbers and give some specific code examples. Converting a string to an integer To convert a string to an integer, you can use the Atoi function from the strconv package. Ato
