How to transform all the negative values into positive values using abs() function.
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int main()
{
int year1,year2,age;
printf("Enter a year : \n");
scanf("%d",&year1);
printf("Enter a year : \n");
scanf("%d",&year2);
age = year1 - year2;
printf("%d \n",age);
age = abs(age);
printf("%d \n",age);
return 0;
}
Comments
Post a Comment