You are on page 1of 6

a <- readline(prompt="enter the number")

a <- as.integer(a)

temp=a

sum <- 0

while(temp>0)

digit=temp%%10

sum=sum+(rem*rem*rem)

temp=temp/10

if(temp==sum){

cat("the given number is armstrong number ")

}else{

cat("the given number is not armstrong number")

x <- 23

y <- 23

if(x>y){

cat(x,"x is greater")

}else if(y>x){

cat(y,"y is greater")

}else{

print("both are same")

}
a <- 0

b <- 1

c=0

cat(a,b,"\t")

for(x in 1:4){

c=a+b

cat(c,"\t")

a=b

b=c

a <-readline(prompt = "enter the digit")

a <- as.integer(a)

fact <- 1

if(a==1){

print("the factorial 0f 1 is 1\n")

}else{

for(x in 1:a)

fact=fact*x

x=x+1

cat("the fatorial is",fact)

a <- readline(prompt="enter the 1st number")


a <- as.integer(a)

b <- readline(prompt="enter the 2nd number")

b <- as.integer(b)

op <- readline(prompt="enter the operator")

op <- as.character(op)

if(op=="+"){

cat("the addition is ",a+b)

}else if(op=="-"){

cat("the substraction is",a-b)

}else if(op=="*"){

cat("the multiplication is",a*b)

}else if(op=="/"){

cat("the division is",a/b)

}else{

cat("wrong choice")

a <- readline(prompt = "enter the the digit")

a <- as.integer(a)

if(a%%2==0){

cat("the given number is even")

}else{

cat("the given number is odd")

a <- readline(prompt="enter the digit")


a <- as.integer(a)

if(a>0){

cat("the given number is positive")

}else if(a<0){

cat("the given number is negative")

}else{

cat("th egiven number is neutral")

a <- readline(prompt="enter the number")

a <- as.integer(a)

temp=a

sum <- 0

while(temp>0)

digit=temp%%10

sum=sum+(rem*rem*rem)

temp=temp/10

if(temp==sum){

cat("the given number is armstrong number ")

}else{

cat("the given number is not armstrong number")

You might also like