myCompiler myCompiler
Deutsch English Español Français Italiano 日本語 한국어 Nederlands Polski Português
Recent
Login Sign up
Recent
Login Sign up
A

@Ashna422

To find quadratic roots

R
3 years ago
roots<-function(a,b,c){ if(delta(a,b,c)>0){ x1=(-b+sqrt(delta(a,b,c)))/(2*a) x2=(-b-sqrt(delta(a,b,c)))/(2*a) roots<-c(x1,x2) } else if(delta(a,b,c)==0){ x=-b/(2*a)

To Check Prime

R
3 years ago
#Function to check for prime primefunc<-function(num){ ans=0 for(i in 1:num){ if(num%%i==0){ ans=ans+1 } } if(ans==2){

Find factorial of a number

R
3 years ago
#To find the factorial of a number: fact<-function(num){ answer=1 for(i in 1:num){ answer=answer*i } print(answer) } fact(10)

Print a Table

R
3 years ago
#Function to print a Table print_table<-function(num){ for(i in 1:11){ print(paste(num,'i','=',num*i)) } } print_table(5)
Previous Next page

Supported languages

Deno JavaScript NodeJS Python Ruby Go C C++ Java C# TypeScript PHP Bash R Octave (MATLAB) Fortran Lua Erlang SQL MySQL MongoDB Clojure D Perl Kotlin Swift Rust Assembly
© 2026 mycompiler.io
Terms of service Privacy policy Contact us