- Κώδικας:
#include <stdio>
main ( )
{
int i, s= 1;
for ( i=1; i<=10; i=i + 2 )
s = s * i;
for ( i=-2; i>=-10; i =i - 2 )
s = s * i;
s=s;
printf ("%d",s);
}
Έχει επεξεργασθεί από τον/την Giorgos3924 στις Κυρ Απρ 11, 2010 4:06 am, 2 φορές συνολικά
#include <stdio>
main ( )
{
int i, s= 1;
for ( i=1; i<=10; i=i + 2 )
s = s * i;
for ( i=-2; i>=-10; i =i - 2 )
s = s * i;
s=s;
printf ("%d",s);
}
#include <stdio.h>
main( )
{
int a,i,sum=0;
printf (" menou: \n ");
printf (" 1.athroisma 1-10 gia kathe arithmo X \n");
printf (" 2.eksodos \n ");
scanf ("%d",&a);
switch (a )
{
case 1:
{
for (i=1 ;i<=10;i=i+1)
{ sum = sum + i;
printf ("%d \n",sum);}
{break;}}
case 2:
{break;}
}
}
#include <stdio.h>
main ( )
{int i,a=10,b,sum=0;
printf ("dwse arithmo :\n");
scanf("%d",&a);
for (i=1;i<=a;i++)
{
printf (" dose ton %d arithmo : ",i);
scanf("%d",&b);
sum = sum + b;
}
printf (" mesos oros : %d ",sum/a);
}
#include <stdio.h>
main ( )
{int a[100],i;
for(i=0;i<=99;i++)
{a[i]=i+1;
printf ("%d \n",a[i]);
}}
#include <stdio.h>
main()
{
int i, a=1;
for(i=1; i<=10; i++)
{
a=a*i;
}
printf ("to ginomeno einai: %d", a);
}
#include <stdio.h>
main()
{
int i=1, a;
for(i=1; i<=100; i++)
{
if (a!=0)
{
scanf ("%d", &a);
}
}
}
#include <stdio.h>
main ()
{
int i,x,j;
for (i=1;i<=10 ;i++)
{
if (x!=0)
{
printf ("dose akeraio\n");
scanf ("%d",&x);
for (j=1;j<=x;j++)
{
printf ("%d\n",x);
}
}
}
}
#include <stdio.h>
main()
{
int A_1[5];
int i;
for (i=0; i<=4; i++)
{
scanf ("%d", &A_1[i]);
}
for (i=0; i<=4; i++)
{
if (A_1[i]==3)
printf ("i thesi toy 3 einai: %d \n", i);
}
}
#include <stdio.h>
main()
{
int A_1[6],i,max;
for (i=0; i<=5; i++)
{
scanf ("%d", &A_1[i]);
}
max=A_1[1];
for (i=0; i<=5; i++)
{
if (A_1[i]>max)
{
max=A_1[i];
}
}
{
printf ("to megisto einai: %d \n", max);
}
}
#include <stdio.h>
main ( )
{int a[11],i;
for(i=1;i<=10;i++)
{a[i]=i*i;
printf ("%d \n",a[i]);
}
}
#include <stdio.h>
main()
{
int i,s=0, A[15];
for(i=0;i<=14;i++)
{
scanf("%d", &A[i]);
}
for(i=0;i<=14;i++)
{
if (A[i]==0)
{
s++;
}
}printf("to miden emfanizetai %d fores", s);
}
#include <stdio.h>
main()
{
int A[3][4];
int a,b;
for (a=0; a<3; a++)
{
for (b=0; b<4; b++)
{
scanf ("%d", &A[a][b]);
}
}
for (a=0; a<3; a++)
{
printf ("\n");
for (b=0; b<4; b++)
printf ("%d ", A[a][b]);
}
}
#include <stdio.h>
main()
{
int A[2][3];
int a,b;
for (a=0; a<2; a++)
{
for (b=0; b<3; b++)
{
scanf ("%d", &A[a][b]);
}
}
for (a=0; a<2; a++)
{
printf ("\n");
for (b=0; b<3; b++)
printf ("%d ", A[a][b]*2);
}
}
#include <stdio.h>
main()
{
int a,b;
printf ("Menou: \n");
printf ("dose 1 gia prosthesi 2 arithmon \n");
printf ("dose 2 gia afairesi 2 arithmos \n");
printf ("dose 3 gia pollaplasiasmo 2 arithmon \n");
printf ("dose 4 gia diairesi 2 arithmon \n");
printf ("dose 0 gia eksodo \n");
scanf ("%d", &a);
switch (a)
{
case 1:
{
printf ("dose 2 akeraious arithmous \n");
scanf ("%d", &a);
scanf ("%d", &b);
printf ("to apotelesma einai: %d", a+b);
break;
}
case 2:
{
printf ("dose 2 akeraious arithmous \n");
scanf ("%d", &a);
scanf ("%d", &b);
printf ("to apotelesma einai: %d", a-b);
break;
}
case 3:
{
printf ("dose 2 akeraious arithmous \n");
scanf ("%d", &a);
scanf ("%d", &b);
printf ("to apotelesma einai: %d", a*b);
break;
}
case 4:
{
printf ("dose 2 akeraious arithmous \n");
scanf ("%d", &a);
scanf ("%d", &b);
printf ("to apotelesma einai: %d", a/b);
break;
}
case 5:
{
break;
}
}
}
#include <stdio.h>
main()
{
int a, sum=0, j=1, x, z, n;
printf ("dose arithmo gia n akeriaous \n");
scanf ("%d", &n);
if (n<100)
{
printf ("Menoy \n");
printf ("1 athroisma akeraion \n");
printf ("2 ginomeno akeraion \n");
printf ("3 athroisma tetragonon \n");
scanf ("%d", &a);
switch(a)
{
case 1:
{
printf ("dose %d akeraious \n", n);
for (a=1; a<=n; a++)
{
scanf ("%d", &z);
sum = sum+z;
}
printf ("to apotelesma einai %d ", sum);
break;
}
case 2:
{
printf ("dose %d akeraious \n", n);
for (a=1; a<=n; a++)
{
scanf ("%d", &z);
j = j*z;
}
printf ("to apotelesma einai %d ", j);
break;
}
case 3:
{
printf ("dose %d akeraious \n", n);
for (a=1; a<=n; a++)
{
scanf ("%d", &z);
sum = sum+(z*z);
}
printf ("to apotelesma einai %d ", sum);
break;
}
}
}
}
#include <stdio.h>
main()
{
int A_1[5],i,a;
for (i=0; i<=4; i++)
{
scanf ("%d", &A_1[i]);
}
loop:
printf ("\n1. antistrofi ektiposi\n");
printf ("2. ektypwsi me paules\n");
printf ("3. ektypwsi se grames\n");
printf ("4. exit\n\n");
scanf ("%d", &a);
switch (a)
{
case 1:
{
for (i=4;i>=0;i--) {
printf ("%d\n", A_1[i]);
}
goto loop;
}
case 2:
{
for (i=0;i<=4;i++)
{
printf ("%d - ", A_1[i]);
}
goto loop;
}
case 3:
{
for (i=0;i<=4;i++)
{
printf ("%d, ", A_1[i]);
}
goto loop;
}
case 4:
break;
}
}
#include <stdio.h>
main()
{
int A_1[5],i,a;
for (i=0; i<=4; i++)
{
scanf ("%d", &A_1[i]);
}
do
{
printf ("\n1. antistrofi ektiposi\n");
printf ("2. ektypwsi me paules\n");
printf ("3. ektypwsi se grames\n");
printf ("4. exit\n\n");
scanf ("%d", &a);
switch (a)
{
case 1:
{
for (i=4;i>=0;i--) {
printf ("%d\n", A_1[i]);
}
break;
}
case 2:
{
for (i=0;i<=4;i++)
{
printf ("%d - ", A_1[i]);
}
break;
}
case 3:
{
for (i=0;i<=4;i++)
{
printf ("%d, ", A_1[i]);
}
break;
}
case 4:
break;
}
}
while ((a>=1) && (a<=3));
}
#include <stdio.h>
main()
{
int a[10];
int x;
for (x=0;x<=9;x++) {
a[x]=x*x;
printf ("%d\n", a[x]); }
}
#include <stdio.h>
main()
{
int a[5], b[5];
int x,y;
for (x=0;x<=4;x++) {
scanf ("%d", &a[x]); }
for (x=0;x<=4;x++) {
scanf ("%d", &b[x]); }
for (x=0;x<=4;x++) {
y=a[x]+b[x];
printf ("%d\n", y); }
for (x=4;x>=0;x--) {
y=a[x]+b[x];
printf ("%d\n", y); }
}
#include <stdio.h>
main()
{
int a[15];
int x,y=0;
for (x=0;x<=14;x++) {
scanf ("%d", &a[x]);
if (a[x]==0) {
y++; } }
for (x=0;x<=14;x++) {
if (a[x]==0) {
printf ("i thesi tou 0 einai %d\n", x); } }
printf ("to 0 emfanistike %d fores\n", y);
}
#include <stdio.h>
main()
{
int a[7];
int x,max=0,min=0;
for (x=0;x<=6;x++) {
scanf ("%d", &a[x]); }
max=a[0];
min=a[0];
for (x=0;x<=6;x++) {
if (a[x]>max) {
max=a[x]; }
if (a[x]<min) {
min=a[x]; } }
printf ("to megisto einai: %d\n kai to elaxisto: %d", max,min);
}
#include <stdio.h>
main()
{
int A[2][4];
int a,b,s=0;
for (a=0; a<2; a++)
{
for (b=0; b<4; b++)
{
scanf ("%d", &A[a][b]);
}
}
for (a=0; a<2; a++)
{
s=s+A[a][1];
}
printf ("%d", s);
}
#include <stdio.h>
main()
{
int A[3][3];
int a,b,s=0;
for (b=0; b<3; b++)
{
for (a=0; a<3; a++)
{
scanf ("%d", &A[a][b]);
}
}
s=A[0][0];
for (a=0; a<3; a++)
{
printf ("\n");
for (b=0; b<3; b++)
{
if (A[a][b]<s)
{
s=A[a][b];
}
printf ("%d ", A[a][b]);
}
}
printf ("\nto elaxisto einai %d", s);
}
#include <stdio.h>
main()
{
int a,n,m,x,y;
printf ("Menou:\n1. Pinakas A[n]\n2. Pinakas B[m][n]\n");
scanf ("%d", &a);
switch (a)
{
case 1:
{
printf ("dose megethos pinaka A[n]\n");
scanf ("%d", &n);
int A[n];
for (x=0;x<n;x++) {
scanf ("%d", &A[x]); }
printf ("\n");
for (x=0;x<n;x++) {
printf ("%d\n", A[x]); }
break;
}
case 2:
{
printf ("dose megethos pinaka B[m][n]\n");
scanf ("%d", &m);
scanf ("%d", &n);
int B[m][n];
for (x=0;x<m;x++) {
for (y=0;y<n;y++) {
scanf ("%d", &B[x][y]); } }
printf ("\n");
for (x=0;x<m;x++) {
printf ("\n");
for (y=0;y<n;y++) {
printf ("%d ", B[x][y]); } }
break;
}
}
}
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main()
{
char onoma[30];
int x;
printf ("dose onoma\n");
gets(onoma);
for (x=0;x<strlen(onoma); x++)
{
printf ("%c",toupper(onoma[x]));
}
}