【正文】
i]。 {i=0。 } n=n/17。 j=n%17。 { scanf(%d,amp。 printf(please input the n :\n)。 char a[17]={0123456789ABCDEFG}。 int n,i=0,j,b[17]。 }},它能讀入一個正整數(shù),并輸出該正整數(shù)的17進制形式,依次用A、B、C、D、E、F、G表示1111116。 printf(\n)。 mn。 printf(%c,printchar)。 j=i。 i++) for(i=0。 scanf(%d,amp。 if (n=40 || n=0)n)。,printnum=39。 char printchar=39。 int n,i,m,j。 共n行,每行n個A,下一行比上一行右移一列.(注:)include define MAX A A A .......... A ... ... A A A .......... A },它能讀入一正整數(shù)n(n40),并輸出如下圖形: } { if(flag==1) else break。 j=i。 { if (tmp==a[i])i++)amp。 for(i=0。 tmp=a[i]。 n=i。 scanf(%d,amp。 {iMAX。()include define MAX 200void main(){ printf(\n)。 printf(%d ,c[o][j])。 jk。 { o++) for(o=0。 c[i][k]=tmp。 jm。 kn。 il。 b[i][j])。 jn。 im。 scanf(%d,amp。 j++) for(j=0。i++) for(i=0。 printf(please input the number in a[%d][%d]:\n,l,m)。 scanf(%d,amp。 printf(please input n again (0n20):\n)。 if (n=20 ||n=0) scanf(%d,amp。 printf(please input m again (0m20):\n)。 if (m=20 ||m=0) scanf(%d,amp。 { scanf(%d,amp。 printf(please input the n :\n)。m)。 scanf(%d,amp。 printf(please input the L :\n)。 int l,m,n,i,k,j,o,a[MAX][MAX],b[MAX][MAX],c[MAX][MAX],tmp=0。(輸入時,相鄰的兩個整數(shù)用空格隔開)。}4. 編一C程序,它能讀入矩陣A的行數(shù)L,列數(shù)M,矩陣B的列數(shù)N,矩陣B的行數(shù)是M。 i,printnum=2,charnum++) for(i=2,printnum=4,charnum=1。 print(i,printnum,charnum,printchar)。i++,printnum+=2,charnum) for(i=1,printnum=2*i1,charnum=ni。 scanf(%d,amp。 printf(please input n again (n10 and n0):\n)。 if (n=10 || n=0)n)。 char printchar=39。 int n,printnum,i,charnum。 printf(\n)。 j=i+printnum1。 icharnum。 ()include void print(int a,int printnum,int charnum ,char printchar){ 1 3 3 3 3 3 . (共2n1個n) n n . . . . . . 3 3 3 3 3 2 2 2 }}第三題編一C程序,它能讀入一正整數(shù)n,(n10),并輸出如下圖形: n++。 ) a[j]=39。 amp。 if (a[j]=39。 ji。 amp。 else printf(sorry! there is more than or less than one hundred number \n)。 if (i=100 i=strlen(a)。 gets(a)。printf(please input the char :\n)。(注:)include include define MAX 100void main(){char a[MAX]。 printf(y(%d)=%d \n,n,y(n))。n)。}void main(){ return { y(n)編一C程序,它能對讀入的任意n(n=0且n50),能計算并輸出y(n)的值。C上機題1. 設(shè) y(n) = 1 n= 1時; y(n) = y(n2)+2*y(n1) n1時。(注:)include int int n。 if (n=1) return 1。 else (y(n2)+2*y(n1))。 int n。 printf(please input the n :\n)。 scanf(%d,amp。}2.編一C程序,它能讀入一個字符串(串長100,串中可能有空格符),計算并輸出該字符串中十進制數(shù)字的個數(shù)。int n=0,i,j。 || i=0) if (i100 amp。 i0){ for(j=0。j++) 039。amp。939。 printf(the length is :%d \n,n)。 1 . nn . 2 2 2 int i,j。 for(i=0。i++) printf(%c ,printchar)。 for(j=i。j++) printf(%d ,a)。 }void main(){ 39。 printf(please input the n:\n)。 scanf(%d,amp。 { n)。 } /*i為打印的數(shù)字printnum為打印數(shù)字的個數(shù)printchar為打印的空格charnum為打印的空格個數(shù) */i=n。 i=1。 print(i,printnum,charnum,printchar)。L,M,N值都小于20), 以及按行讀入矩陣A的L*M個元素(整數(shù))及矩陣B的M*N個元素(整數(shù)),計算并輸出A與B的矩陣乘積(按行,列輸出)。()include define MAX 20void main(){l)。 printf(please input the m :\n)。 scanf(%d,amp。n)。 if (l=20 ||l=0) printf(please input l again (0l20):\n)。 l)。 } {m)。 } {n)。 } il。 jm。 a[i][j])。 printf(please input the number in b[%d][%d]:\n,m,n)。 for(i=0。i++) for(j=0。j++) scanf(%d,amp。 for(i=0。i++) for(k=0。k++) { tmp=0。 for(j=0。j++) tmp+=a[i][j]*b[j][k]。 } printf(the result is:\n)。 oi。 for(j=0。j++) }},它能讀入n(n200)個整數(shù)(以9999為結(jié)束標記,9999不算在內(nèi),相鄰的兩個整數(shù)用空格隔開),找出第1到第n1個數(shù)中第一個與第n個數(shù)相等的那個數(shù),并輸出該數(shù)讀入時的序號(序號從1開始記)。 int i,j,n,flag=0,tmp,a[MAX]。 printf(please input the number :\n)。 for(i=0。i++) a[i])。 if (a[i]==9999) break。 }in amp。 flag==0。 flag=1。 } if (flag==0) printf(Sorry! there is not found!\n)。 printf(the aquality number place is :\n)。 printf(%d,++j)。 printf(\n)。 A A A .......... A 40void main(){ 39。A39。 printf(please input the n:\n)。 scanf(%d,amp。 { printf(please input the n again(0n%d) :\n,MAX)。 n)。 }in。 { for(j=0。j++) { } for(m=0。m++) printf(%c,printnum)。 (注:)include void main(){n)。 do b[i++]=j。 while(n!=0)。 for(i。i) printf(%c,a[j])。 }}第八題編一C程序,它能讀入兩個整數(shù)m與n,計算并輸出m與n的絕對值的最大公約數(shù)及最小公倍數(shù)。include void main() { int nm,r,n,m,t。 scanf(%d %d,amp。n)。 m*=1。 n*=1。 nm=n*m。 if (mn) n=m。 } { m=n。 r=m%n。 printf(最大公約數(shù):%d\n,n)。 printf(最小公倍數(shù):%d\n,nm/n)。如輸入為3B時,輸出為50。 void main(void){char str[64],*p。printf(input the number:\n)。x=strtoul(str,amp。printf(the number is %ld\n,x)。 void main(void