Pages

Monday, 29 January 2018

Division Using a function

Division Using a function
/*program uses a fubction to divide one digit by another*/
#include<stdio.h>
#include<conio.h>
/*declaring function*/
float div(float,float);
main()
{
      float dig1=0,dig2=0,result=0;
      printf("Please enter a number: ");
      scanf("%f",&dig1);
    
       while(dig2 == 0)
       {
                  printf("\n\n\nNow enter a number to divide first digit: ");
                  scanf("%f",&dig2);
                  if(dig2==0)
                  {
                       printf("\tWarning!\nDenominator can not be zero.");
                   }
                

       }