0

Z = ( a - b ) ( a - c )٢

How can I write prog calculate this equation

5th Jun 2017, 2:11 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
5 Réponses
+ 19
#include <iostream> #include <math.h> using namespace std; int main() { int a; int b; int c; cin>>a>>b>>c; double Z = sqrt((a-b)*(a-c)); cout<<Z; return 0; } //homework done! ^_^
5th Jun 2017, 2:14 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 10
Is that a ² (square) symbol? Cuz if it is, just replace @Val's equation with : double Z = (a-b)*(pow((a-c), 2));
5th Jun 2017, 3:30 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
thanks a lot :)
5th Jun 2017, 2:22 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
+ 2
but I think it hav some thing wrong coz we have ( a - c )2 ? I meant squrt !
5th Jun 2017, 2:25 PM
Ahmed Abofteem
Ahmed Abofteem - avatar
+ 2
thanks again ^_^
5th Jun 2017, 4:05 PM
Ahmed Abofteem
Ahmed Abofteem - avatar