Skermaster Posted May 28, 2015 Share Posted May 28, 2015 Prosím pomohol by niekto s programom?program mám napísať v programe DevC++Zadanie:Napíšte program, ktorý do súboru vstup.txt zapíše čísla od 1 do 100 tak, aby v každom riadku bolo 10 čísel a 10 stĺpcov. Do súboru vystup.txt vypíšte len čísla, ktoré sú deliteľné číslom 3 alebo 4. Link to comment Share on other sites More sharing options...
Tom Posted May 28, 2015 Share Posted May 28, 2015 Neviem ci v tom druhom subor chces cisla do 100, alebo ci ich chces znovu nejako usporiadat, toto ich vypise 1 do riadka do 100, upravit to verim zvladnes. Pouzit mozes aky program chces je to ciste C, zbehne ti to aj v roku 1989 :)Nech sa paci #include <stdio.h> #include <stdlib.h> int main(){ int i; FILE *f; f = fopen("vstup.txt","w"); for(i=1;i<=100;i++){ fprintf(f,"%i",i); if(i%10==0) fprintf(f,"\n"); else fprintf(f," "); } fclose(f); f = fopen("vystup.txt","w"); for(i=1;i<=100;i++) if(i%3==0||i%4==0) fprintf(f,"%i\n",i); fclose(f); return 0; } 1 Link to comment Share on other sites More sharing options...
Skermaster Posted May 28, 2015 Author Share Posted May 28, 2015 Ďakujem za pomoc :D Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now