beginners error

This is a discussion on beginners error within the C Programming forums, part of the General Programming Boards category; Code: I am Code: new to programming in c and my task is to write a simple program that is ...

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    beginners error

    Code:
    I am
    Code:
    new to programming in c and my task is to write a simple program that is able to compute the area under a curb using the trapezoidal rule. I wrote the program but it will not compile, the error I m getting is:
     
     expected expression before } token
    project1.c:24: error: expected ; before numeric constant
     
    and this are my codes:
     
    #include <stdio.h>
    int main(void)
    {
             int a, b, N,h,i,counter,A;
            
     printf(" enter the interval a and b");
     scanf("%d\n%d\n", &a, &b);
            
     prinf("enter the number of trapezoids you would like to  use");
            scanf("%d\n", &N);
            
     h= (b-a)/N;
            
     while((h*((i*i)+(counter*counter))/N) <= N){
                      for(i=a; i<=b; i++)
                               for(counter=a; counter=b; counter++){
           A=(h*((i*i)+(counter*counter))/2);
            }
    
    printf("the area under the curb from %d to %d is: %d", a, b, A);
            
    counter 0;
    }

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    2,698
    Duplicate already asked here.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginners, C++ or C#?
    By Zeusbwr in forum C++ Programming
    Replies: 30
    Last Post: 10-10-2004, 10:54 PM
  2. Beginners ERROR!!!
    By Game_Addict27 in forum C++ Programming
    Replies: 7
    Last Post: 08-21-2004, 08:56 AM
  3. GUI for beginners
    By Micko in forum C++ Programming
    Replies: 6
    Last Post: 06-24-2004, 05:40 AM
  4. Beginners FAQ
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 04-14-2004, 07:32 PM
  5. beginners help
    By stormswift in forum C Programming
    Replies: 5
    Last Post: 02-11-2002, 02:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21