Help for the error in dev c++

Thread Starter

mkbutan

Joined Sep 30, 2008
299
hi
can any one guide what iam doing wrong in this program as dev c++ compiler giving error which i cant understand here is the print screen of the same and the code

Rich (BB code):
/*
  Name: mkbutan 
  Copyright: 
  Author: 
  Date: 02/08/12 20:38
  Description: pg8  1.5
*/
#include<stdio.h>
#include<conio.h>
#define PERIOD   10
#define PRINCIPAL  5000.00
main()
{
int year;
float amtount,value,inrate;
amount = PRINCIPAL;
inrate = 0.11;
year = 0;
while(year<=PERIOD)
{
                   printf("%2d %8.2f\n",year,amount);
                   value = amount + inrate * amount;
                   year = year + 1;
                   amount = value;
                   }
getch();
}
 

Attachments

Thread Starter

mkbutan

Joined Sep 30, 2008
299
thanks dear it was my silllllllly mistake , but it took my full day to understand and just rectified by you by just one post
thanks once again
 

Thread Starter

mkbutan

Joined Sep 30, 2008
299
hi sir is this code correct? pl help.
Rich (BB code):
/*
  Name: mkbutan
  Copyright: 
  Author: 
  Date: 02/08/12 23:06
  Description: exec 1.5 pg21
*/
#include<stdio.h>
#include<conio.h>
void main()
{
     int r,x;
     float pi;
     printf("Enter the Radius : \n",r);
     scanf("%d",r);
     x = (2*pi*r)*(2*pi*r);
     printf("The Area of a Circle is : %d",x);
     getch();
     }
 

ErnieM

Joined Apr 24, 2011
8,377
The area of a circle is ∏ times radius squared, or in C:

x = pi*r*r; // since C doesn't have a square function

And don't forget to define pi either.

It looks like you want to calculation to be repeated over and over... hence your getch() To get that to work you need to put the code inside a loop.
 

Brownout

Joined Jan 10, 2012
2,390
It looks like you want to calculation to be repeated over and over... hence your getch() To get that to work you need to put the code inside a loop.
Hi ErineM,

When C programs run in a console, the console terminates as soon as the program finished. If one wants to see the results, he need to prevent that from happening. That might be the reason for the getche().
 
Top