完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
#include "stdio.h"
main() { int i, sum=0 ; for( i = 1 ; i <= 100 ; i++ ) { sum += i ; } printf("Total of 1 to 100 is %dn", sum ) ; } 2. #include #ifndef ARRAY_SIZE #define ARRAY_SIZE 100 #endif main() { int a[ARRAY_SIZE] ; int i; for ( i = 0 ; i < ARRAY_SIZE ; i++ ) { a = 0 ; } } 3. #include int fib( int x ); main() { int i ; for ( i = 0 ; i < 100 ; i++ ) { printf("The fibonacci number %d is %d n", i, fib(i) ); } } int fib( int x ) { if ( x < 2 ) return (1); else return( fib(x-1) + fib (x-2) ) ; } 5. /*----------------------------------------------*/ /* */ /* My first C program */ /* */ /* This program simply add two numbers together */ /* */ /*----------------------------------------------*/ #include int main( void ) { int i ; int j ; int total=0 ; printf( "Please Enter the first number :> " ); scanf( "%d", &i ); total += i ; printf( "Please Enter the second number :> " ); scanf( "%d", &j ); total += j ; printf( "%d add to %d is %dn", i, j , total ) ; } |
|
相关推荐
4 个讨论
|
|
【瑞萨RA6E2】瑞萨E2S软件安装过程,等待过程玩下97_e2 studio_ZGZZ
234 浏览 0 评论
514 浏览 0 评论
【原创】【RA4M2-SENSOR开发板评测】低功耗+USB综合测试
826 浏览 0 评论
1366 浏览 2 评论
814 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
16911 浏览 31 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 03:15 , Processed in 1.158246 second(s), Total 48, Slave 39 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2366