CÓïÑÔÉÏ»úÁ·Ï°²Î¿¼´ð°¸ ÏÂÔØ±¾ÎÄ

} printf ( \ Output

Please input array A (5 elements):17 34 -11 2 5? is input */

Please input array B (5 elements): 10 7 -9 0 25? input */

Array C is: -11 -9 0 2 5 7 10 17 25 34 7-12

/* Blue

/* Blue is

ÀûÓÃÊý×飬ÇóÒ»¸öintÐÍÕûÊý¶ÔÓ¦µÄ¶þ½øÖƲ¹Âë²¢Êä³ö£¨×¢Ò⸺Êý£©¡£

Program #include <> main() { int n, m, b[16]={0}, i=15; printf(\ scanf(\ m = n>=0? n: -n; /*mµÈÓÚʲô£¿*/ /* ÕýÊýµÄ²¹Âë */ while(m) { b[i--]=m%2; /*ÈçºÎÀí½âb[i--]*/ m = m/2; } /* ¸ºÊýµÄ²¹Âë */ if(n<0) { for(i=0; i<16; i++) /* È¡·´ */ b[i] = b[i]==1? 0: 1; /*¿É·ñд³Éb[i]=!b[i];£¿*/ for(i=15; i>=0; i--) /* ¼Ó1 */ /*ΪºÎҪѭ»·£¿*/ { if(b[i]==0) { b[i] = 1; break; } else b[i] = 0; } } printf(\ for(i=0; i<16; i++) { printf(\ if(i==7) /*Õâ¸öifÓï¾äÊÇʲô×÷Óã¿*/ printf(\ } } Output (1)

Please input an integer: 9? /* Blue is input */ The binary complemental code of 9 is: 00000000 00001001 Output (2)

Please input an integer: -9? The binary complemental code of -9 is: 7-13

/* Blue is input */

±àд³ÌÐò£¬°´ÕÕÏÂÃæÒªÇóÌî³ä²¢ÏÔʾ5ÐÐ5ÁеľØÕó£¨ÒªÇó£ºÊ¹ÓõÄprintf

Óï¾ä²»¶àÓÚ2¸ö£© 7-14 7-15 7-16 7-17 7-18 7-19 7-20 7-21

£¨1£©×óÉÏÈý½ÇΪ+1 £¨2£©ÓÒÏÂÈý½ÇΪ-1

£¨3£©´ÓÓÒµ½×óµÄ¶Ô½ÇÏßΪ0¡£ ʾÀý£º 1 1 1 1 0

1 1 1 0 -1 1 1 0 -1 -1 1 0 -1 -1 -1 0 -1 -1 -1 -1

Program (1) #include <> #define N 5 main() { int a[N][N]={0}, i, j; for(i=0; iN-i-1; j--) a[i][j]=-1; for(j=0; j #define N 5 main() { int i, j; for(i=0; i

{ } for(j=0; j

Program #include <> #define M 4 #define N 5 main() { int a[M][N], i, j, p, q; printf(\ for(i=0, p=0, q=0; i

ÊäÈëÒ»¸ö4*3µÄ¾ØÕó£¨ÕûÐÍ£©£¬¼ÆËãÿÐÐÖÐ×î´óÖµµÄƽ¾ùÖµ£¨ÊµÐÍ£©¡£

Program #include <> #define M 4 #define N 3 main() { int a[M][N], b[M], i, j; /* Êý×éb´æ·ÅÿÐеÄ×î´óÖµ */ float ave=0; printf(\ for(i=0; i

Ñî»ÔÈý½ÇÐΣ¨Ò²½ÐPascalÈý½ÇÐΣ©ÈçÏ£º 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 ¡­¡­

±àд³ÌÐò£¬Éú³ÉÒ»¸ö15ÐеÄÑî»ÔÈý½ÇÐΣ¬´æ·ÅÔÚÒ»¸ö¶þάÊý×éÀï¡£ÊäÈëÕý

ÕûÊýn£¨1~15£©£¬¶ÁÈ¡²¢Êä³öÑî»ÔÈý½ÇÐεÄǰnÐÐÔªËØ¡£ 7-33

j

£¨Ìáʾ£ºÈç¹ûÓÃi±íʾÐУ¬ÓÃj±íʾÁУ¬ÔòµÚiÐÐjÁÐÔªËØpi, j=pi-1,j-1 + pi-1,

£©

Program #include <> #define N 15 main() { int yh[N][N]={1}, n, i, j; /* Éú³ÉÑî»ÔÈý½ÇÐÎ */ for(i=1; i

ÕóAºÍnÐÐpÁеľØÕóBÏà³Ë£¬µÃµ½mÐÐpÁеľØÕóC£¬CÖеÄiÐÐjÁÐÔªËØcijÓÉÏÂÁй«Ê½µÃµ½£º 7-35 7-36 7-37

cij??aikbkj

k?1nÆäÖУ¬aikÊǾØÕóAÖеÄiÐÐkÁÐÔªËØ£¬bkjÊǾØÕóBÖеÄkÐÐjÁÐÔªËØ¡£ ±àд³ÌÐò£¬ÊäÈë3ÐÐ4ÁеľØÕóAºÍ4ÐÐ5ÁеľØÕóB£¬Êä³öAºÍBµÄ³Ë»ý

¡ª¡ª3ÐÐ5ÁеľØÕóC¡£

Program #include <> #define M 3 #define N 4 #define P 5 main ( ) { int a[M][N], b[N][P], c[M][P], i, j, k; printf(\ for ( i = 0; i < M; i ++ ) for ( j = 0; j < N; j++ ) scanf ( \ printf(\ for ( i = 0; i < N; i ++ ) for ( j = 0; j < P; j++ ) scanf ( \ printf ( \matrix A and matrix B is : \\n\ for ( i = 0; i < M; i ++ ) { for ( j = 0; j < P; j++ ) { for ( k = 0, c[i][j] = 0; k < N; k ++ ) c[i][j] += a[i][k] * b[k][j]; printf ( \ } printf ( \ } } 7-38

ÅжÏÒ»¸ö¶þάÊý×éÊÇ·ñ´æÔÚ°°µã£¬Èô´æÔÚ£¬ÔòÊä³ö°°µã¼°ÆäÐкźÍÁкţ»

·ñÔòÊä³öûÓа°µãÐÅÏ¢¡£¡°°°µã¡±ÊÇÖ¸ÕâÑùµÄÔªËØ£ºËüÔÚ±¾ÐÐÊÇ×î´óÔªËØ£¬¶øÔÚ±¾ÁÐÊÇ×îСµÄÔªËØ¡£ Program #include <>