Write a program in C to find the absolute/mod value of a number entered through the keyboard

Write a program in C to find the absolute/mod value of a number entered through the keyboard.

            #include <stdio.h>
            #include <conio.h>
            void main() {
                        int num; clrscr();
                        printf("Number : ");
                        scanf("%d", &num);
                        if(num>=0){

                        printf("\nAbsolute Value : %d", num);
                        } else {
                                    printf("\nAbsolute Value : %d", num*(-1));
                        }
                        getch();
            }


Post a Comment