6. 用scanf函数输入数据,使a=3,b=7,x=8.5,y=71.82,c1=A, c2=a,并将其依次输出。
时间: 2024-05-06 22:17:32 浏览: 9
下面是代码示例:
```c
#include <stdio.h>
int main() {
int a, b;
float x, y;
char c1, c2;
scanf("%d%d%f%f %c %c", &a, &b, &x, &y, &c1, &c2);
printf("a=%d, b=%d, x=%.1f, y=%.2f, c1=%c, c2=%c\n", a, b, x, y, c1, c2);
return 0;
}
```
输出结果为:
```
a=3, b=7, x=8.5, y=71.82, c1=A, c2=a
```
相关问题
用scanf函数输入数据,使a=3,b=7,x=8.5,y=71.82,c1=A, c2=a,并将其依次输出。
下面是代码示例:
```c
#include <stdio.h>
int main() {
int a, b;
float x, y;
char c1, c2;
scanf("%d%d%f%f %c %c", &a, &b, &x, &y, &c1, &c2);
printf("a=%d, b=%d, x=%.1f, y=%.2f, c1=%c, c2=%c\n", a, b, x, y, c1, c2);
return 0;
}
```
输出结果为:
```
a=3, b=7, x=8.5, y=71.82, c1=A, c2=a
```
用下面的scanf函数输入数据,使a=3,b=7,x=8.5,y=71.82,c1='a’,c2=‘a’,并将其依次输出
可以使用以下代码实现:
```c
#include <stdio.h>
int main() {
int a, b;
float x, y;
char c1, c2;
scanf("%d%d%f%f %c %c", &a, &b, &x, &y, &c1, &c2);
printf("a=%d, b=%d, x=%.1f, y=%.2f, c1=%c, c2=%c\n", a, b, x, y, c1, c2);
return ;
}
```
输出结果为:
```
a=3, b=7, x=8.5, y=71.82, c1=a, c2=a
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)