16

I want to find the maximum value of two numbers, and print it. I want to print all three numbers. I am using the following code.

#include<stdio.h>
#include<conio.h>
main()
{
     //clrscr();
     int a,b,c;
     printf("insert two numbers:");
     scanf("%d%d", &a, &b);
     c = (a>b) ? a : b;
     printf("\nmaximum of %d",a," and %d",b,"  is = %d" c);
     getch();

}

However, I receive two syntax errors (Please find the attached figure). Could anybody help me out with it?

1
  • 2
    Put the '\n' at the end not the begining because it might not print anything unless another '\n' occurs or you explicitly call fflush(). Also, don't learn conio.h if you can and main() must return int. Commented Jan 4, 2016 at 19:15

2 Answers 2

38

Change the line where you print the output to:

printf("\nmaximum of %d and %d is = %d",a,b,c);

See the docs here

Sign up to request clarification or add additional context in comments.

Comments

7
printf("\nmaximum of %d and %d is = %d",a,b,c);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.