C Program to find absolute value of given number | C Language program to find absolute value of given number in C

C Program to find absolute value of given number | C Language program to find absolute value of given number in C



#include
#include
void main()
{
  int a,b;
  clrscr();
  printf("enter the value of a");
  scanf("%d",&a);
  if(a<0)
  {
   b=a*-1;
   printf("\nabsolute value of %d is %d",a,b);
  }
  else
   {
     printf("\nabsolute value=%d",a);
   }
   getch();
}




No comments:

Post a Comment