0

How can I use abs on C?

Please show me with code

12th Sep 2020, 9:51 PM
Shakiba Majd
Shakiba Majd - avatar
10 Antworten
+ 3
Shakiba Majd the problem is that all of the places where it should have "\n" have instead "/n". Use back slash as the metacharacter, not forward slash. Make certain to fix it in scanf() and printf(). Because of the invalid format, scanf() is reading the input wrong, and that is why your values are coming out wrong. The problem is not related to the abs() function. In fact, the program works remarkably well after this fix.
13th Sep 2020, 7:54 AM
Brian
Brian - avatar
+ 3
See this i used abs in my Pattern program https://code.sololearn.com/c4KinIeDq7ck/?ref=app
13th Sep 2020, 1:28 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
Shakiba Majd where is your code post it
13th Sep 2020, 6:34 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Shakiba Majd you are welcome. Good job on the program. I did not know that technique of finding min and max. It makes a good challenge.
13th Sep 2020, 9:26 AM
Brian
Brian - avatar
+ 1
#include<stdlib.h> header Use like abs(-10) returns 10
12th Sep 2020, 9:59 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 Thanks. But I want to find the maximum and the minimum,sum,product and average by taking four integers, and at the same time not using the condition structure so I need abs for it and my code isn't working properly! https://code.sololearn.com/cm1tSpUQe6PC/?ref=app My output must be up to six decimal places
12th Sep 2020, 10:07 PM
Shakiba Majd
Shakiba Majd - avatar
+ 1
Brian You're right!! I forgot it... Thank you so much for your explanation. Good luck 💐 https://code.sololearn.com/ch4NZWSKENYf/?ref=app
13th Sep 2020, 8:49 AM
Shakiba Majd
Shakiba Majd - avatar
0
😅🐍🐍😆 I saw it.Do you know what my code is not working?
13th Sep 2020, 6:27 AM
Shakiba Majd
Shakiba Majd - avatar
0
Brian I'm glad about this, thanks.
13th Sep 2020, 9:40 AM
Shakiba Majd
Shakiba Majd - avatar