0
Help me to find error in program
https://code.sololearn.com/cgb29a9eEeBw/?ref=app take input as 1 10 20 20 10 20 10 20 10 if a==b==c==d then it prints yes else no
3 Answers
+ 2
Your mistake ia you calculating expression first then taking input .
First you should write Input statements then calculate a,b,c.....
#include <stdio.h>
#include<math.h>
int main()
{
//write your code here
int z1,z2,z3,z4,y1,y2,y3,y4;
int T,i,a,b,c,d;
scanf("%d\n",&T);
scanf("%d%d%d%d%d%d%d%d",&z1,&z2,&z3,&z4,&y1,&y2,&y3,&y4);
scanf("%d%d%d%d",&a,&b,&c,&d);
a=sqrt((z2-z1)*(z2-z1)+(y2-y1)*(y2-y1));
b=sqrt((z3-z2)*(z3-z2)+(y3-y2)*(y3-y2));
c=sqrt((z4-z3)*(z4-z3)+(y4-y3)*(y4-y3));
d=sqrt((z4-z1)*(z4-z1)+(y4-y1)*(y4-y1));
for(i=0;i<T;i++)
{
if((a==b)&&(b==c)&&(c==d)&&(d==a))
{
printf("Yes");
}
else
{
printf("No");
}
}
return 0;
}
+ 1
Put scanf's between line 7 and 8. And don't forget to enter each value on separate lines:
1
2
3
.
.
.
And press submit
0
thanks ♨️TEJAS MK-82♨️ QTWizard



