Thursday, September 29, 2011

WAP to find absolute value of a number

#include<stdio.h>
#include<conio.h>
void main()
{
    int num;
    clrscr();
    printf("enter the number");
    scanf("%d",&num);
    if(num<0)
    {
        num=-num;
        printf("the absolute of no. is %d",num);
    }
    else
    {
        printf("the absolute of no. is %d",num);
    }
        getch();
}

No comments:

Post a Comment