Ad

Chapter - 3: The Decision Control

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


Ad
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;
}
Ad

© 2024 Garbage Valuegarbage value logo