如何编写接受字符的代码 [英] How can I write a code that accepts characters

查看:55
本文介绍了如何编写接受字符的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要键入charcatars(小和大写),直到我输入。



我尝试过:



i need to type charcatars (small and capital) untill i type .

What I have tried:

int main()
{
    int number ,a , b=1;
    printf("please enter a number\n");
    scanf( "%d", &number );

    while(number > 0 )
    {
         a = number % 10;
         b = b * a ;
         number = number / 10 ;
    }
    if(b%2==0)
    {
         printf("The number is Multiplication-Even.\n");
    }
    else
         printf("The number is NOT Multiplication-Even.");
  return 0;
}

推荐答案

在实际获取输入之前,您正在执行输入操作。这意味着您从尚未操作的输入中获得了 big
You are performing input manipulation before actually getting the input. That means you are getting big assigned from not yet manuipulated input.


这篇关于如何编写接受字符的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆