{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software) for windows 7 like Code::Blocks,dev c++ . Download dev c++ its free and install it in your computer.open dev c++ go to file-->new-->source file.}
#include<stdio.h>
#include<conio.h>
int main (void)
{
int num;
printf ("enter your number: ");
scanf ("%i", &num);
if(num < 0)
num = -num;
printf ("The absolute value is %i\n", num);
getch();
return 0;
}
Output
enter your number: -100
The absolute value is 100
For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}
IS IT HELPFIL? comment.
Yes it is helpful
ReplyDeleteits help ful dear
ReplyDeleteVery informative article.Thank you author for posting this kind of article .
ReplyDeletehttp://www.wikitechy.com/view-article/absolute-value-program-in-cpp-using-function
Both are really good,
Cheers,
Venkat
Thank you so much.
ReplyDelete