0
Why my code is not working in c?
#include<stdio.h> int main(){ int length =4, breadth=5; int area=length × breadth; printf("%d", area); return 0; }
5 Antworten
+ 7
The correct symbol for multiplication is *
+ 5
int area = length * breadth;
...and also, instead of using breadth, it's more common to use width.
+ 2
use '*' rather than using '×' , cuz in programming we define multiply with '*' not '×'
+ 2
The issue in your code is with the multiplication operator. In C, you should use '*' for multiplication, not '×' (which is a different Unicode character).
Here is the corrected version of your code:
#include <stdio.h>
int main() {
int length = 4, breadth = 5;
int area = length * breadth;
printf("%d", area);
return 0;
}
This code will work correctly and print 20 which is the result of 'length * breadth'.
0
Ahahahaha, that is a easy one. It should be * not x. xD