当前位置:编程学习 > C/C++ >>

求画c语言ns图 程序如下

#include <stdio.h> int main( ) { int i , n; unsigned long a[40]; FILE *fp = fopen("data.txt", "w"); a[0] = 3; a[1] = 5; for(i = 2; i < 40; i++) a[i] = a[i-2] + a[i-1]; system("cls"); for(i = 1; i <= 40; i++) { printf("%-10ld", a[i-1]); fprintf(fp,"%-10ld", a[i-1]); if(i%10 == 0) { printf("\n"); fprintf(fp, "\n"); } } n = 0; printf("\n\n\n"); fprintf(fp, "\n\n\n"); for(i = 0; i < 40; i++) { if(a[i]%3 == 0) { printf("%-10ld", a[i]); fprintf(fp,"%-10ld", a[i]); n++; if(n%10 == 0) { printf("\n"); fprintf(fp, "\n"); } } } return 0; }
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,