//#include "stdafx.h"//If the vc++6.0, with this line.#include using namespace std;int main(int argc,char *argv[]){ int n,i,s; cout > n) || n

#include int main(){ int sum = 0; int n,i; scanf("%d",&n); for(i=0;i

int n,ans=0; scanf("%d",&n); for(i = 1; i

#include void main() { int n,i,s=0; cin>>n; for(i=2;i

#include using namespace std;int main(){int i,n,k=1,m=1;cin>>n;for(i=1;i

#include using namespace std; int main() { int i,s=1; for(i=1;i

1.对2取余为零为偶数,非零即为奇数 #include int main(){ int num; for (int i = 0; i < 2; i++) { printf("intput a number:"); scanf("%d", &num); if (num % 2 == 0) printf("It's Even.\n"); else printf("It's Odd.\n"); } return 0;}

#include int main() { int i,sum=0; printf("%d\n",100/2/2*100); // 按照 100内50个奇数 50个奇数又可以 变成 (1+99)(3+97)这样 for (i=1;i

#include void main(){ int sum = 0; int i; for(i = 0; i < 50; i++){ sum = sum+2*i+1;//奇数使用2*i+1表示,依次为1,3,5,。。。,99 } cout

#include using namespace std;int main(){ int num,a; int jnum=0,onum=0; cin>>num; while(num--){ cin>>a; if (a%2==0) onum++; else jnum++; } cout

网站首页 | 网站地图
All rights reserved Powered by
copyright ©right 2010-2021。