全文预览

C语言程序设计精髓编程题在线测试

上传者:qnrdwb |  格式:docx  |  页数:35 |  大小:315KB

文档介绍
("Input capital, year:");Р scanf("%lf,%d",&capital,&year);Р printf("Compound interest (Y/N)?");Р scanf(" %c",&n);Р if(year==1||year==2||year==3||year==5||year==8)Р {Р switch(year)Р {Р case 1:rate=0.0225; break;Р case 2:rate=0.0243; break;Р case 3:rate=0.0270; break;Р case 5:rate=0.0288; break;Р case 8:rate=0.0300; break;Р }Р if(n=='n'||n=='N') deposit=capital*(1+rate*year);Р else deposit=capital*pow((1+rate),year);Р printf("rate = %.4f, deposit = %.4f\n",rate,deposit);Р }Р else printf("Error year!\n");Р return 0;Р}Р#include<stdio.h>Рmain()Р{Рint man , women ,children ;Рprintf( "Man Women Children\n" ) ;Рfor(man = 0 ; man <17 ; man++)Р{Рfor(women = 0 ; women <25 ;women++) Р{Рchildren = 30 -women -man ;Рif(3*man +2*women + children ==50)Р{Рprintf("%3d%8d%8d\n" ,man,women ,children) ;Р}Р}Р}Р}

收藏

分享

举报
下载此文档