1)Write a R code for armstrong number
2)What will be the output of the following R code?
x <- c(“a”, “b”, “c”, “d”) for(i in 1:4) {
+ ## Print out each element of ‘x’
+ print(x[i])
+ }
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
1) Armstrong number: A number is thought of as an Armstrong number if the sum of its own digits raised to the power number of digits gives the number itself.
For example, 0, 1, 153, 370, 371, 407 are three-digit Armstrong numbers and, 1634, 8208, 9474 are four-digit Armstrong numbers and there are many more.
EXAMPLE:Let’s consider 370 since it is a three-digit number so it could be expressed as: (3*3*3)+(7*7*7)+(0*0*)= 27 +343+0 =370
CODE For Armstrong number:
2)Output of Following code will be
“a”
“b”
“c”
“d”