Feb 9, 2020

C program to devide the intiger number without using division "/" sign

Ex: Write a C program to devide the intiger number without using division "/" sign. How to write a C program to devide the intiger number without using division "/" sign. C program to devide the intiger number without using division "/" sign.

Input from user:
Enter number1: 25
Enter number2: 5

Expected output:
Division is 5




Program:

#include<stdio.h>
void main()
{
int no1,no2,c=1;

printf("enter the no1\n");
scanf("%d",&no1);
printf("enter the 2nd no\n");
scanf("%d",&no2);

while(no1>=no2)
{
no1=no1-no2;
c++;
if(no1==no2)
{
printf("division is %d",c);
}
}

}


Above program shows the following output:



No comments:

Post a Comment

If you have any doubts, please discuss here...