Chapter - 3: The Decision Control

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


C
Sections
8
Exercises
#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;
}

© 2021 Garbage Valuegarbage value logo