Division of Numbers

Problem Statement
Write a c program to first take 2 values from user say n and m ,then calculate n/m .consider all the cases.print with suitable message
#include<stdio.h>
int main()
{
  int n,m;
  float k;
  printf("enter the values of n and m :");
  scanf("%d %d",&n ,&m);
  if(m==0)
    {
      printf("the divison is not defined");
    }
  else
    {
      k=(n/m);
      printf("the value ofn/m is %f",k);
    }
  return 0;
}

No comments:

Post a Comment