Earn while u Learn

Tips tweaks hacks on computer with C C++ VB tutorials and ways to earn money online

ad

program to find the absolute value of a number

this program will help you to find the absolute value of a number, it will also help you to teach little kids absolute value.
Code:
__________________________________________________________
#include(stdio.h)
#include(conio.h)
main()
{
int a,abs;
printf("Enter a number");
scanf("%d",&a);
if(a>=0)
{
printf("\t\n\t%d is the absolute value of %d",a,a);
}
else
{
abs=(-1)*a;
printf("\t\n\t%d is the absolute value of %d",abs,a);
}
getch();
}
__________________________________________________________

0 comments:

Sign in / Join

Labels