Skip to content

Commit ae39b8a

Browse files
committed
if
1 parent af1c5fa commit ae39b8a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

prog.6.1.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Program to calculate the absolute value of an integer
2+
3+
#include <stdio.h>
4+
5+
int main (void)
6+
{
7+
int number;
8+
9+
printf ("Type in your number: ");
10+
scanf ("%i", &number);
11+
12+
if ( number < 0 )
13+
number = -number;
14+
15+
printf ("The absolute value is %i\n", number);
16+
17+
return 0;
18+
}

0 commit comments

Comments
 (0)