1. เรียนรู้
  2. /
  3. Courses
  4. /
  5. Optimizing R Code with Rcpp

Connected

Exercises

Print to the console

You can use Rprintf() to print formatted output to the console. It is similar to the sprintf() function in R, and uses the format specifiers:

  • %d to specify an integer
  • %s to specify a string

คำแนะนำ

100 XP

Write a function that adds two integers (x and y) and prints the following message about it:

** <x> + <y> = <x + y>