/*换钱问题 一毛 两毛 五毛*/ |
#include<stdio.h> |
void main() |
{ |
int x,y,z,i=0; |
for ( x=1; x<100; x++ ) |
for ( y=1; y<50; y++ ) |
for ( z=1; z<20; z++ ) |
if ( x+2*y+5*z==100 ) |
{ |
i++; |
printf ( "第%d种:%d个1角 %d个2角 %d个5角\n " ,i,x,y,z ); |
} |
printf ( "共有%d种换法!\n" ,i ); |
} |