By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,620 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

expression syntax error

P: 1
im a newbie in c programming
can somebody help me
expression syntax error
in cpp 10

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int n1,n2,n3;
  7. printf("\nn1:");scanf("%d",&n1);
  8. printf("\nn2:");scanf("%d",&n2);
  9. printf("\nn3:");scanf("%d",&n3);
  10. if(n1<n2)&&(n1<n3)&&(n2<n3)
  11. {
  12. printf("\n%d%d%d",n1,n2,n3);
  13. }
  14. else if(n2<n1)&&(n2<n3)&&(n1<n3)
  15. {
  16. printf("\n%d%d%d",n2,n1,n3);
  17. }
  18. else if(n3<n1)&&(n3<n2)&&(n2<n1)
  19. {
  20. printf("\n%d%d%d",n3,n2,n1);}
  21. getch();
  22. }
Dec 24 '12 #1

✓ answered by divideby0

the if/else if/else lines all need an extra set of parens

Expand|Select|Wrap|Line Numbers
  1. if( (n1 < n2) && (n2 < n3) && (n1 < n3) )
  2. {
  3.    ...
  4.  

Share this Question
Share on Google+
1 Reply


100+
P: 131
the if/else if/else lines all need an extra set of parens

Expand|Select|Wrap|Line Numbers
  1. if( (n1 < n2) && (n2 < n3) && (n1 < n3) )
  2. {
  3.    ...
  4.  
Dec 24 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.