Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
#include<stdio.h>
void main()
    {
    int t,u[5],a[5],i,s;
    printf("enter a value of t");
    scanf("%d",&t);
    printf("enter values of u and a");
    for (i=0;i&lt;5;i++)
        {
        scanf("%d",&u[i]);
        scanf("%d",a[i]);
        s=u[i]*t+1/2 a[i]*t*t;
        printf("value of u is %d \n value of a is %d \n value of t is %d \n value of s is %d \n,u[i],a[i],t,s);
        }
    }
    }

apparently.. when i try to compile this program.. all i get in return is "non function call"... or "statement missing". please help asap.
Posted
Updated 27-Sep-15 8:18am
v4
Comments
Member 12015032 27-Sep-15 13:30pm    
apparently.. when i try to compile this program.. all i get in return is "non function call"... or "statement missing". please help asap.
PIEBALDconsult 27-Sep-15 13:35pm    
Which line?
PIEBALDconsult 27-Sep-15 13:36pm    
It appears you are missing a quote (") in your last printf.
Philippe Mori 28-Sep-15 22:51pm    
Also for one scanf, then argument are incorrect.

1 solution

C++
#include<stdio.h>
void main()
    {
    int t,u[5],a[5],i,s;
    printf("enter a value of t");
    scanf("%d",&t);
    printf("enter values of u and a");
    for (i=0;i<5;i++)
        {
        scanf("%d",&u[i]);
        scanf("%d",a[i]);
        s=u[i]*t+1/2 a[i]*t*t;
        printf("value of u is %d \n value of a is %d \n value of t is %d \n value of s is %d \n", u[i], a[i], t, s);
        }
    }</stdio.h>

A quote was missing in printf and I removed a } at the end.
Compiler should be happier now.

I recommend a professional text editor, syntax coloring would have show the first problem and parenthesis matching would have spot the second.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900