Q-18. Write a C program to find the absolute value of a number.

0

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main()
  4. {
  5.    int m = abs(-50);     // m is assigned to 50
  6.    int n = abs(23);    // n is assigned to -23

  7.    printf("Absolute value of m = %d\n", m);
  8.    printf("Absolute value of n = %d \n",n);
  9.    return 0;
  10. }





Post a Comment

0Comments
Post a Comment (0)