Δημοσιεύτηκε: 28 Ιούλ 2011, 14:26
- Κώδικας: Επιλογή όλων
/*=============================================
Upologismos arithmwn pou diairoun teleia
enan sugkekrimeno arithmo pou tha dwsei o xristis
mesa se ena euros timwn pou dinei pali o xristis
27/7/11
* Star_Light
=============================================== */
#include<stdio.h>
int main()
{
int i,z,n;
printf("Dwse to euros twn arithmwn: \n");
scanf("%d",&n);
printf("Dwse me poion arithmo thes na diairounte teleia: \n");
scanf("%d",&z);
printf("Akeraioi pou boroun na diairethoun plirws mesa sto [0,n=%d]: \n");
for(i=0; i<=n; i++)
{
if(i%z==0) /* To i%z einai upoloipo an auto sxesiaka isoutai me 0 diladi false
tote den iparxei ipoloipo ara teleia diairesi
*/
printf("%d\n",i);
}
return 0;
}
χρησιμο για μαθητες δημοτικου-γυμνασιου
