R Lang

R Program to find remainder without using the modulus operator1 min read

In this program, You will learn how to find the remainder without using a modulus operator in R.

Example: How to find remainder without using modulus operator in R

This is a program written in the R programming language that prompts the user to enter two numbers, and then calculates the remainder of the first number divided by the second number. The remainder is then printed to the console.

The program first reads the two numbers from the user using the readline() function and stores them in the variables x and y. It then enters a while loop that continues until x is less than y. Inside the loop, x is updated to be x - y, which is the remainder of x divided by y. When the loop exits, x contains the remainder and is printed to the console using the print() function.

The output of this program would depend on the values of x and y that are entered by the user. Here is an example of what the output might look like:

Leave a Comment