编写程序:输入提一个正整数,判断该数是奇数还是偶数,并输出结果

如题所述

void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
温馨提示:内容为网友见解,仅供参考
第1个回答  2006-04-02
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
第2个回答  2006-04-02
void main()
{
int a;
scanf("%d",&a);
if (a%2==0)
{
printf("偶数");
}
else
{
printf("奇数");
}
}

program JO;
var
a:integer;
begin
read(a);
if a mod 2=0 then
writeln('偶数')
else
writeln('奇数');
end.

Dim A As Integer
Input A
If A Mod 2 = 0 Then
Print "偶数"
Else
Print "奇数"
End If

以上分别是C、Pascal和Basic的程序
第3个回答  2020-01-12
private
sub
command1_click()

dim
n
as
long

n
=
val(text1.text)

if
n
mod
2
=
0
then

label2.caption
=
"是偶数"

else

label2.caption
=
"是奇数"

end
if
end
sub

编写程序:输入提一个正整数,判断该数是奇数还是偶数,并输出结果
writeln('偶数')else writeln('奇数');end.Dim A As Integer Input A If A Mod 2 = 0 Then Print "偶数"Else Print "奇数"End If 以上分别是C、Pascal和Basic的程序 void main(){ int a;scanf("%d",&a);if (a%2==0){ printf("偶数");} else { printf("奇数");} } program ...

求解c语言中 输入一个正整数,判断该数是奇数还是偶数。
include <stdio.h>void main(){ int n; printf("请输入一个正整数:\\n"); scanf("%d", &n); if (n%2 == 0) printf("%d 是偶数\\n", n); else printf("%d 是奇数\\n", n);}

判断正整数n是否同时含有奇数和偶数数字的编程
printf("Contains only even numbers:"); \/\/只含偶数数 for (n=i-1;n>=0;n--)printf("%d",a[n]) ;} if (i!=0&&j!=0) \/\/奇数偶数均有 { printf("Both containing even numbers:");for (n=i-1;n>=0;n--)printf("%d",a[n]) ;printf("\\nAlso contains an even ...

C语言编程:输入一个正整数n,判断它是否同时含有奇数字偶数字
void main(void){ int n;char a[11],i,odd=0,even=0;printf("Type an integer...\\nn=");scanf("%d",&n);itoa(n,a,10);for(i=0;*(a+i);i++)if(*(a+i)%2) odd=1;else even=1;if(odd && even) printf("Yes!\\n");else if(odd) printf("No,Only odd!\\n");else...

编写一个程序输入一个整数,判断它是奇数还是偶数
1.声明个变量n 2.获得输入附值到变量中 3.判断变量能否被2整除(n%2是否为1,如果等于1则是奇数,如果是0则是偶数)是取余数的意思 4.输出

用键盘输入一个整数,并显示输出它是奇数(JISHU)还是偶数(OUSHU).
从键盘输入一个整数,用switch语句判断它是奇数还是偶数,并输出判断结果。include<stdio.h>int main(){int r;printf("请输入一个整数;");scanf("%d",&r);int j=r%2;switch( j=r%2){case 0: printf("偶数");break;case 1: printf("奇数") ;break;}return 0;} ...

从键盘输入一个正整数n,编程判断这个数是否同时含有奇数字和偶数字
h> void main(){ int y,f0=0, f1=0, x;printf("intput a number:\\n");scanf("%d",&y);while(y>0){ x=y%10;x%2==0?f0++:f1++;y=y\/10;} if(f0!=0&&f1!=0) printf("这个数同时含有奇数字和偶数字\\n");else printf("这个数不是同时含有奇数字和偶数字\\n");} ...

从键盘输入一个数,判断它的奇偶性,如果是奇数则输出yes,否则输出no?
include<stdio.h> int main(){ int n;scanf("%d",&n);printf("%s\\n",n%2?"yes":"no");return 0;}

c语言 判断奇偶数 简单的代码
include <stdio.h>int main(){ int a = 0; scanf("%d", &a); if(0 == a%2) { printf("even"); return 1; } printf("odd"); return 1;}

c语言设计输入一个正整数判断其中各个数字是否奇数偶数交替出现是输出...
include<stdio.h>int main(){int p, n;scanf("%d", &n);do{p = n%10;n \/= 10;if(p%2 + n%10%2 != 1)break;}while(n);if(n)puts("no");elseputs("yes");}

相似回答