Https://ide.codingblocks.com/s/250791

i have written code for armstrong of number but it is not working

@satyamsingla Armstrong number is a number that is equal to the sum of cubes of its digits. So your code is logically incorrect

i am writing in general value of number not cube. so please check

@satyamsingla by definition you have to cube the digits, why are you taking powers according the position of that number?

i am trying to sove problem that is in programming fundamentals- is armstrong number
please check my code wrt question

@satyamsingla share link/description of the problem or ask the doubt in the respective section to avoid confusion.

https://online.codingblocks.com/app/player/74836/content/96955/4790/code-challenge

@satyamsingla that link is not working for me, please copy paste the description given along with sample input/output

Take the following as input.

A number
Write a function which returns true if the number is an armstrong number and false otherwise, where Armstrong number is defined as follows.

A positive integer of n digits is called an Armstrong number of order n (order is number of digits) if.

abcd… = pow(a,n) + pow(b,n) + pow(c,n) + pow(d,n) + ….

1634 is an Armstrong number as 1634 = 1^4 + 6^4 + 3^4 + 4^4

371 is an Armstrong number as 371 = 3^3 + 7^3 + 1^3

Input Format

Single line input containing an integer

Constraints

0 < N < 1000000000

Output Format

Print boolean output for each testcase.
“true” if the given number is an Armstrong Number, else print “false”.

Sample Input

371

Sample Output

true

@satyamsingla while calculating sum, you made your x variable 0, so comparing it to the sum will not work.

please do correction in my code

@satyamsingla https://ide.codingblocks.com/s/250810

1 Like

thankyou so much :))))))))))

@satyamsingla please mark the doubt as resolved :slight_smile:

that code worked weell. i have written this code using function but is nott working. please make changes in it https://ide.codingblocks.com/s/250812

@satyamsingla https://ide.codingblocks.com/s/250814 function call had incorrect syntax

mam pleaase check my code https://ide.codingblocks.com/s/251401
ques is
Given number of rows N, you have to print a Hollow Rhombus. See the output for corresponding given input.

Input Format
Single integer N.

Constraints
N <= 20

Output Format
Print pattern.

Sample Input
5
Sample Output
*****


@satyamsingla i am unable to see the output properly


maam i have a doubt in this code. i understood the code but i didnt understand what is return doing in it?
and how is the end line cout<<a is displaying the ans.

@satyamsingla character array is passed by reference so any changes made by the function are reflected on the original array. here, return keyword just passes the flow of control to the previous function. Since the return type is void, it doesnt have to return anything