用C语言编程,不要有多余的输入输出,↙代表换行 1.输出三位数 将数字 C语言编程,C++环境下可以编译运行
c\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1 \u4f8b\u5982\uff1a\u8f93\u51651 2 3 a 4\u2199 \u8f93\u51fa\uff1a1234\u6ca1\u6709\u9519\uff0c\u53ef\u4ee5\u8dd1\uff0c\u6211\u521a\u521a\u7f16\u8bd1\u94fe\u63a5\u4e4b\u540e\u8fd0\u884c\u4e86\u4e00\u4e0b\uff0c\u5bf9\u4f60\u7684\u4f8b\u5b50\u6765\u8bf4\u5b8c\u5168\u6b63\u786e\uff0c\u5c31\u662f\u4e0d\u77e5\u9053\u5728\u4f60\u7684\u7f16\u8bd1\u5668\u4e0b\u662f\u4e0d\u662f\u53ef\u4ee5\u7f16\u8bd1\u6210\u529f\u3002\u5199\u7a0b\u5e8f\u6700\u597d\u7b26\u5408\u6807\u51c6C\u7684\u89c4\u8303\uff0cmain\u524d\u9762\u52a0\u4e0aint \u7136\u540ereturn 0.\u8fd8\u6709\u4f60\u8fd9\u4e2aint\u53d8\u91cf\u8303\u56f4\u6709\u9650\uff0c\u5982\u679c\u4f4d\u6570\u592a\u591a\uff0c\u7a0b\u5e8f\u5c31\u4f1a\u51fa\u9519\uff0c\u53ef\u4ee5\u4ecd\u7136\u4f7f\u7528char\uff0c\u6328\u4e2a\u5b57\u7b26\u518d\u6b21\u8f93\u51fa\u5c31\u884c\u4e86\u3002\u4e5f\u5c31\u662fif(ch>='0' && ch<='9') printf("%c",ch);
#include int main(){ int n, i, j; char st; scanf ("%d %c", &n, &st); char row = st, col; for (i = 0; i < n; ++i){ for (j = 0; j < n - i - 1; ++j){ printf (" "); } col = row; for (j = 0; j <= i; ++j){ printf ("%c", col); if (col=='Z'){ col = 'A'; }else { col++; } } if (col=='A'){ col = 'Z'; }else { col--; } for (j = 0; j < i; ++j){ if (col=='A'){ col = 'Z'; }else { col--; } printf ("%c", col); } printf ("\n"); if (row == 'Z'){ row = 'A'; }else { row++; } } return 0;}
#include <stdio.h>
int is_same(int x, int y);
int main()
{
int j=0, k=0;
int x=0;
int n = 0;
int a=0, b=0, c=0;
int ge,shi,bai;
scanf("%d",&n);
for(j=1; j<=9; j++)
{
for(k=1; k<=9; k++)
{
if(j==n || k==j || n==k)
continue;
a = n*100 + j*10 + k;
for(x=200; x<1000; x++)
{
ge = x%10;
shi = (x/10)%10;
bai = x/100;
if(ge==n || ge==j || ge==k)
continue;
if(shi==n || shi==j || shi==k)
continue;
if(bai==n || bai==j || bai==k)
continue;
if(bai==ge || bai==shi || shi==ge)
continue;
if(x == a*2)
b = x;
if(x == a*3)
c = x;
}
if(b==a*2 && c==a*3)
{
if(!is_same(b,c))
{
printf("%d,%d,%d
",a,b,c);
}
}
}
}
return 0;
}
int is_same(int x, int y)
{
int x_bai,x_shi,x_ge;
int y_bai,y_shi,y_ge;
x_ge = x%10;
x_shi = (x/10)%10;
x_bai = x/100;
y_ge = y%10;
y_shi = (y/10)%10;
y_bai = y/100;
if(x_ge==y_ge || x_ge==y_shi || x_ge==y_bai)
{
return 1;
}
if(x_shi==y_ge || x_shi==y_shi || x_shi==y_bai)
{
return 1;
}
if(x_bai==y_ge || x_bai==y_shi || x_bai==y_bai)
{
return 1;
}
if(x_ge==0 || x_shi==0 || y_shi==0 || y_ge==0)
{
return 1;
}
return 0;
}
最后一题:
#include <stdio.h>
int main()
{
int i=0, j=0;
int n=0;
char word;
char nword;
scanf("%d %c",&n,&word);
for(i=1; i<=n; i++)
{
for(j=0; j<n-i; j++)
{
printf(" ");
}
nword = word++;
if(word > 'Z')
{
word = 'A';
}
for(j=1; j<=i*2-1; j++)
{
printf("%c",nword);
if(j < i)
{
nword ++;
if(nword > 'Z')
{
nword = 'A';
}
}
else
{
nword --;
if(nword < 'A')
{
nword = 'Z';
}
}
}
printf("
"); //打印完一行后需要换行
}
printf("
");
return 0;
}
绛旓細include<stdio.h> void main(){ int a[10];int i,j,sum=0,flge;//鐢╢lge璁板綍鏄笉鏄礌鏁 printf("璇杈撳叆10涓暟:\n");for(i=0;i<10;i++)scanf("%d",&a[i]);for(i=0;i<10;i++){ flge=0;if(a[i]==1)continue;for(j=2;j<=a[i]/2;j++){ if(a[i]%j==0){...
绛旓細include "stdio.h"int main(){ char str[100]={0};int i;printf("Please input a string:");gets(str);for(i=0;str[i]!=0;i++)if(str[i]!='a' && str[i]!='A' && str[i]!='f' && str[i]!='5' && str[i]!='#')printf("%c",str[i]);printf("\n");} ...
绛旓細include<stdio.h> void main(){ int a[10],i,n=0,sum=0;printf("璇杈撳叆鍗佷釜鏁存暟锛");for(i=0;i<10;i++){ scanf("%d",&a[i]);if(a[i]%2!=0){ n++;sum=sum+a[i];} } printf("鍏辨湁%d涓鏁帮紝瀹冧滑鐨勫拰鏄細%d\n",n,sum);} ...
绛旓細浠g爜濡備笅锛歩nclude <stdio.h> int main(){ char c;int letters=0,space=0,digit=0,other=0;printf("璇杈撳叆涓琛屽瓧绗︼細");while ((c=getchar())!='\n'){ if (c >= 'a'&&c <= 'z' || c >= 'A'&&c <= 'Z'){ letters++;} else if (c == ' '){ space++;} else if...
绛旓細include<stdio.h> int main(){ int a,*p;p=&a;scanf("%d",p);printf("%x\n",*p);return 0;}
绛旓細浠g爜濡備笅锛歩nclude<stdio.h> intmain(){ charx,y;printf("璇杈撳叆涓涓瓧姣嶏細");scanf("%c",&x);if(x>='a'&&x<='z')y=x-32;if(x>='A'&&x<='Z')y=x+32;printf("杞崲鍚庣殑瀛楃涓猴細%c\n", y);} 浠g爜鍦―EVC++鐜涓嬭繍琛屾晥鏋滃涓嬶細...
绛旓細姝ら鍙互鍋氾紝浠g爜濡備笅锛//#include "stdafx.h"//If the vc++6.0, with this line.#include "stdio.h"int main(void){ char R[27]="ZABCDEFGHIJKLMNOPQRSTUVWXY",tmp[10]; int n,i,j; while(1){ printf("Input n(int n>0)...\nn="); if(scanf("%d",&n) &&...
绛旓細,a);n=strlen(a); // 鑾峰彇杈撳叆瀛楃涓茬殑闀垮害b[0] = a[0]; // 灏 a 瀛楃涓茬殑绗竴涓肩粰 b 瀛楃涓瞝en = 1; // 鍒濆鍖 b 瀛楃涓茬殑闀垮害for(int i=1;i<n;i++) {flag = 0; // 娣诲姞鏍囪瘑锛堜负0鍒欒〃绀哄间笉鍚岋紝涓1鍒欒〃绀哄肩浉鍚岋級for(int j=0;j<len;j++) {if(a[i]...
绛旓細include <stdio.h> include <math.h> void main(){ int i,j,num=0,n,flg;printf("杈撳叆浠绘剰灏忎簬20鐨勬鏁存暟:\n >>");scanf("%d",&i);while(i>=20||i<=0){ printf("Error!\n璇烽噸鏂拌緭鍏:\n >>");scanf("%d",&i);} n=i*100;printf("\n%d鑷%d涔嬮棿鐨勭礌鏁版湁:\n",i,n...
绛旓細include <stdio.h>int main(){ char c[50]; int i,el=0,sp=0,nu=0,other=0; gets(c);//杈撳叆瀛楃涓 for(i=0; i<strlen(c); i++)//strlen杩斿洖瀛楃涓查暱搴 { if((c[i]>='A' && c[i]<='Z')||(c[i]>='a' && c[i]<='z')) el++; else...