Chapter - 3: The Decision Control

Find the absolute value of a number entered through the keyboard.


C
Sections
8
Exercises

A

B

C

D

E

F

G

H

I

J

K

1

2

3

4

5

6

7

8

9

10

11

12

#include<stdio.h>
#include<conio.h>
int main()
{
	int a;
	
	printf("Enter any number : ");
	scanf("%d", &a);
	
	if(a>0)
		printf("\n\n%d is it's absolute value.", a);
	else
		printf("\n\n%d is it's absolute number.", -1*a);
		
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo