我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

我要怎么定义N个数,求

img

供参考:

#include <stdio.h>
int main()
{
    int N, n, odd = 0, even = 0;
    scanf("%d", &N);
    while (N--)
    {
        scanf("%d", &n);
        if (n % 2 == 0)
            even++;
        else
            odd++;
    }
    printf("%d %d",odd,even);
    return 0;
}

你没学过数组吗

int N;
int a[N];    // 这是定义一个整型数组,一共有N个元素
scanf("%d",&N);

近期文章

  • 关于Vs中C++ setw()的问题・_・?
  • 来自大一小白的提问,求告诉一下
  • qt4.7.3 + wince6.0 + opengles + vs2008
  • 如何用if else写这个程序?
  • 怎么按照要求写?C++
  • 关于高斯低通滤波器(GLPF)的题——图像分析基础
  • rsyslog的配置文件]加了模板和参数,但实际显示ip不是真实地址
  • 关于vs code的一个问题。
  • 请教一下,为什么我修改名片还是修改不了,提示 if 下的声明无效?
  • 请教一下各位python编程学习问题
  • python爬虫请求返回503,selenium也不管用
  • 数据连接时报错,显示SQLSTATE[HY000] [1049] Unknown database 'gushuye'
  • c++这个谁懂呀阿阿
  • Serial monitor is not supported on network ports such as 192.168.43.10 for the null in this release
  • 这个程序是怎么编写的,有会的嘛
  • 关乎点云轮廓提取算法
  • 共享打印机079错误
  • 请问下这怎么做急需要紧急
  • 中信银行全付通sign怎么实现的
  • 求助如何利用Python +selenium实现长网页截图

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华