C语言实验——图形输出(字符常量练习)
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("#\n");
printf("##\n");
printf("###\n");
printf("####\n");
printf("#####\n");
printf("######\n");
return 0;
}
/***************************************************
User name: sm180216刘志鹏
Result: Accepted
Take time: 0ms
Take Memory: 140KB
Submit time: 2018-10-15 10:54:54
****************************************************/
A+B Problem
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
scanf("%d %d",&a, &b);
printf("%d\n",a+b);
return 0;
}
/***************************************************
User name: sm180216刘志鹏
Result: Accepted
Take time: 0ms
Take Memory: 144KB
Submit time: 2018-10-15 11:08:39
****************************************************/
C语言实验——求两个整数之和
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
a=123;
b=456;
printf("sum is %d\n",a+b);
return 0;
}
/***************************************************
User name: sm180216刘志鹏
Result: Accepted
Take time: 0ms
Take Memory: 96KB
Submit time: 2018-10-15 11:10:03
****************************************************/
C语言实验——交换两个整数的值(顺序结构)
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x,y,t;
scanf("%d%d",&x,&y);
t=x;
x=y;
y=t;
printf("%d %d",x,y);
return 0;
}
/***************************************************
User name: sm180216刘志鹏
Result: Accepted
Take time: 0ms
Take Memory: 148KB
Submit time: 2018-10-15 11:15:30
****************************************************/
C语言实验——逆置正整数
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,x,y;
scanf("%d",&x);
a=x%10;
b=x/10%10;
c=x/100%10;
y=a*100+b*10+c;
printf("%d\n",y);
return 0;
}
/***************************************************
User name: sm180216刘志鹏
Result: Accepted
Take time: 0ms
Take Memory: 148KB
Submit time: 2018-10-15 11:51:21
****************************************************/
C语言实验——买糖果
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,x,y;
scanf("%d",&x);
a=x%10;
b=x/10%10;
c=x/100%10;
y=a*100+b*10+c;
printf("%d\n",y);
return 0;
}
/***************************************************
User name: sm180216刘志鹏
Result: Accepted
Take time: 0ms
Take Memory: 148KB
Submit time: 2018-10-15 11:51:21
****************************************************/
C语言实验——买糖果
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,b,c;
scanf("%d",&n);
b=n*10/3;
c=n*10%3;
printf("%d %d",b,c);
return 0;
}
/***************************************************
User name: sm180216刘志鹏
Result: Accepted
Take time: 0ms
Take Memory: 144KB
Submit time: 2018-10-15 11:53:21
****************************************************/