1.
*****
****
***
**
*
2.
*
**
***
****
*****
1. ******* ***** *** * 2. * *** ***** ******* ***** *** *
#include <stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a>10)
printf("%d",a*a);
else if(a<10)
printf("%d",2*a);
return 0;
}
#include <stdio.h>
int main(void)
{
int i;
int j;
int n;
int k;
scanf("%d",&n);
for(i=n;i>=1;i--)
{
for(j=1;j<n+1-i;j++)
{
printf(" ");
}
for(j=1;j<=2*i-1;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
#include <stdio.h>
int main(){
int num;
printf("성적 입력 : ");
scanf("%d", &num);
switch(num/10){
case 10 :
case 9 :
printf("A\n");
break;
case 8 :
printf("B\n");
break;
default :
printf("???\n");
break;
}
}
#include <stdio.h>
int fact(int n)
{
int sum;
if(n==1)
return 1;
else
sum=fact(n-1)*n;
return sum;
}
int main()
{
int n;
scanf("%d",&n);
printf("%d\n",fact(n));
return 0;
}
1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 20 19 18 17 16 21 22 23 24 25
.png)
저번주에 accept받는데 실패하신 분들은 저나 다른분들에게 물어봐서 한번 해보도록 합시다^^.png)
1 3 2 4 5 6 10 9 8 7 11 12 13 14 15 21 20 19 18 17 16
int* a;
int b=5;
int** c;
c=&a;
a=&b;
**c=9;
printf("%d %d",*c,**c);
int* p; p = (int *)malloc(SIZEOF(int)*n);
.png)
1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
#include <stdio.h>
#include <stdlib.h>
typedef struct node node;
struct node{
int data;
struct node* next;
};
int main(){
int i;
node* head=(node*)malloc(sizeof(node));
node* tmp = NULL;
tmp=head;
for(i=0 ; i<10 ; i++){
tmp->data=i+1;
tmp->next = (node*)malloc(sizeof(node));
//printf("%d\n",tmp->data);
tmp=tmp->next;
}
tmp=head;
for(i=0 ; i<10; i++){
printf("%d\n",tmp->data);
tmp=tmp->next;
}
return 0;
}
#include <stdio.h>
struct node{
int data;
struct node *next;
};
int main()
{
struct node *head=(struct node*)malloc(sizeof(struct node));
struct node *tmp = NULL;
int i;
int n;
tmp=head;
for(i=0;i<10;i++)
{
tmp->next=(struct node*)malloc(sizeof(struct node));
tmp->data=i+1;
tmp=tmp->next;
tmp->next=NULL;
}
scanf("%d",&n);
for(tmp=head;tmp->next!=NULL;tmp=tmp->next)
{
if(tmp->next->data==n)
tmp->next=tmp->next->next;
printf("%d ",tmp->data);
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
typedef struct node node;
struct node{
int data;
struct node *next;
};
int main(void){
int i;
node *head = (node *)malloc(sizeof(node));
node *tmp = NULL;
tmp = head;
for(i=0;i<10;i++){
tmp->data = i;
tmp->next = (node *)malloc(sizeof(node));
tmp = tmp->next;
}
tmp = head;
for(i=0;i<10;i++){
printf("%d\n",tmp->data);
tmp = tmp->next;
}
return 0;
}
#include <iostream>
using namespace std;
int main(){
int a;
cin>>a;
cout<<a<<endl;
}
#include <stdio.h>
#include <iostream>
int swap(int*, int*);
int main(){
int a,b;
a=10;
b=20;
swap(&a,&b);
printf("%d %d\n",a,b);
return 0;
}
int swap(int *a, int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
return 0;
}