![](/style/images/good.png)
![](/style/images/bad.png)
Write a C program to calculate the area of the rectangle? Using the inputs from...
source link: https://www.codeproject.com/Questions/5318832/Write-a-C-program-to-calculate-the-area-of-the-rec
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
See more:
the code is not working
how can i do it
What I have tried:
#include<stdio.h> int main(){ int length, breadth; printf("What is the length of the rectangle\n"); scanf("%d", &length); printf("What is the breadth of the rectangle\n"); scanf("%d", &breadth); printf("The area if your rectangle is %d", length*breadth); return 0; }
C
and C#
are completely different languages. You have tagged your question as "C#", but the question title and code says you're using "C".If I copy'n'paste your code into an online C compiler (Online C Compiler - online editor[^]) it compiles cleanly, runs, and does exactly what I expect:Quote:the code is not running
the code is not working
how can i do it
What is the length of the rectangle 21 What is the breadth of the rectangle 42 The area if your rectangle is 882 ...Program finished with exit code 0 Press ENTER to exit console.
So the code does run, the code does work - I'd suggest that it's "finger trouble" at your end which obviously we can't see or help with: I'd suggest that you go back to yoru basic instructions on how to compile the code, and double check that to make sure it has been compiled correctly, linked correctly, and that there are no errors. Then check your instructions on how to run the EXE file that compilation and linking produced.
Sorry, but we can't help you with that - we have no access to your system at all!
You can do it like this:
int length, breadth, area; ... area = length*breadth; printf("%d\n", area);
Add your solution here
Preview
Existing Members
...or Join us
Your Email Password
Your Email Optional Password
Please subscribe me to the CodeProject newsletters
- Read the question carefully.
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
- If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
- Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK