Ticker

6/recent/ticker-posts

Division without using ‘/’ operator?

 Division without using ‘/’ operator?


#include<stdio.h>

void main() {

int a, b, i=0;

printf("Enter the dividend and divisor\n");

scanf("%d%d",&a,&b);

while(a>=b){

a=a-b;

i++;

}

printf("qoutient is :%d \nremainder : %d\n",i,a);

}

output:-

Enter the dividend and divisor

10 2

qoutient is :5 

remainder : 0


కామెంట్‌ను పోస్ట్ చేయండి

0 కామెంట్‌లు