VOOZH about

URL: https://www.geeksforgeeks.org/r-language/write-an-r-program-for-hello-geeks/

⇱ Write an R Program for "Hello Geeks" - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Write an R Program for "Hello Geeks"

Last Updated : 23 Jul, 2025

Hello, Geeks is the first basic program in any programming language. Let’s write the program in R programming language. All one needs to do is display the message “Hello World” on the screen. Let’s look at the program:

R Program to Print “Hello Geeks” using the print() function:

The following R program displays “Hello Geeks” in the output.

  • Declare a variable named "message" and assign the string "Hello Geeks" to it.
  • Use the "print()" function to display the value of the "message" variable, which is "Hello Geeks".

This code declares a variable containing a message and then prints that message using the "print()" function in R.


Output
[1] "Hello Geeks"

Printing "Hello Geeks" using cat() function:

The following R program displays “Hello Geeks” in the output.

  • Declare a variable named "message" and assign the string "Hello Geeks" to it.
  • Use the "cat()" function to display the value of the "message" variable, which is "Hello Geeks".


Output:

[1] "Hello Geeks"

R Program to Print “Hello Geeks” using message() function:

Output:

Hello Geeks

R Program to Print “Hello Geeks” using the sprintf() function:

Output:

[1] "Hello Geeks"
Comment
Article Tags:
Article Tags:

Explore