+ 1
can someone please figure out why this is not working?
#include <stdio.h> int main() { int length, width, area; scanf("write the length and width of a rectangle:- %d %d", &length, &width); area = length * width; printf("the area of the rectangle is: %d \n", area); /* 50 */ return 0; }
3 Respuestas
+ 4
The problem is you cannot print on scanf. scanf is for only taking input:
Please see the code:
https://code.sololearn.com/cXdODrEUzPiO/?ref=app
+ 2
i made area a float and typecast float into the area equation. Also printf a %.2f
https://code.sololearn.com/cC385zSpl2yI/?ref=app