U E D R , A S I H C RSS

One/주승범

No older revisions available

No older revisions available



{{|
1 2 5 6 8 10|}}

~cpp 
#include <stdio.h>

void main()
{    int n = 0;
  do
  {
      n = n + 1;
      if (n==3 || n==4 || n==7 || n==9 )
         continue ;
         printf ("%d ", n) ;
  }while(n<10);
  system("PAUSE");	
 

}


{{|
1부터 10까지 더하기|}}
~cpp 
#include <stdio.h>

void main()
  int a ;
  int n = 0;
  for ( a = 1 ; a<11 ; a++)
  { n = n + a ;
}
printf("%d", n);
  system("PAUSE");	
}

{{|1,2,3만 뜨고 나머지는 error |}}
~cpp #include <stdio.h>

void main()
{
 int a;
 printf (" 숫자를 입력하시오 \n "); 
 scanf ("%d", &a);
 if ( a==1 || a==2 || a==3  )
  printf ("%d", a);
  else
  printf (" error \n");
system("PAUSE");  
}

{{| 1->64, 2->10, 3->23, 나머지는 error|}}
~cpp #include <stdio.h>

void main()
{
 int a;
 printf (" 숫자를 입력하시오 \n "); 
 scanf ("%d", &a);
 if ( a==1 )
  printf ( "64" );
 else if ( a==2 ) 
  printf ( "10" );
 else if ( a==3 )
  printf ( "23" );
 else
  printf (" error \n");
system("PAUSE");  
}

{{|배열|}}
~cpp #include <stdio.h>

void main()
{
 /*int a;
 printf (" 숫자를 입력하시오 \n "); 
 scanf ("%d", &a);
 if ( a==1 )
  printf ( "64" );
 else if ( a==2 ) 
  printf ( "10" );
 else if ( a==3 )
  printf ( "23" );
 else
  printf (" error \n");*/
  int a[10];
  int b = 10;
  int c = 0;
  for ( ; b>0 ; b--)
  {
      a[c] = b ;
      printf ("a[%d] %d\n", c, b);
      c = c + 1;
      }
       
system("PAUSE");  
}

One
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:54
Processing time 0.0278 sec