TASK-
Write a C program which perform division operation and exit the program if someone enters 0
CODE:
#include<stdio.h>
int div(int n,int d);
int main(){
int num,deno=2,m=9;
printf("Enter nominator: ");
scanf("%d",&num);
do
{
num=div(num,deno);
printf("\nAfter dividing nominator by 2 the new answer is %d",num);
printf("\n\nif you want to stop the division Enter zero else enter any number: ");
scanf("%d",&m);
}while (m!=0);
getchar();
return 0;
}
int div(int n,int d)
{
n=n/d;
return n;
}
EXPECTED OUTPUT: