如何使用printf在字符串中打印多个变量?

我想找到两个数字的最大值,然后打印出来。 我想要打印所有三个数字。 我使用以下代码。

#include #include 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(); } 

但是,我收到两个语法错误(请参见附图)。 有人可以帮帮我吗?

将输出打印的行更改为:

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

请参阅此处的文档

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