R Lang

R Program to find quotient without using the division operator1 min read

In this program, You will learn how to find quotient without using division operator in R.

Example: How to find quotient without using division operator in R




The code first reads in values for x and y from the user and stores them as integers. It then initializes a variable c to 0.

The code then enters a while loop which continues to execute as long as x is greater than or equal to y. Inside the loop, the code subtracts y from x and increments c by 1. This continues until x is no longer greater than or equal to y.

After the while loop has finished executing, the code prints the value of c to the console. This value is the quotient of x and y, which is the number of times y can be subtracted from x before x becomes less than y.

For example, if x is 10 and y is 3, the code would execute the while loop 4 times and c would be 4. This is because 3 can be subtracted from 10 four times before 10 becomes less than 3.

Leave a Comment