Squared


This is a companion discussion topic for the original entry at https://toph.co/p/squared

my outcome is right but why does the test in toph say wrong answer

#include<stdio.h>
int main()
{
    float side,area;
    scanf("%f",&side);
    area=side * side;
    printf("%f",area);
    return 0;

}

@AG_Ohe11 Try using int instead of float.

@AG_Ohe11 kire ohe naki?

i tested this program and it also work then why here its saying compilation wrong…
#include <stdio.h>
#include<math.h>

int main()
{
int side,area;
scanf("%d",&side);
area=side*side;
printf("%d",area);

return 0;

}

There is no problem with your code. The compiler compiled it successfully. So it’s not possible to get Compilation Error.