自我介绍

大家好,我的名字叫杨泰隆,是仙宫(西安工大)16级的学生,性格内向和善,比较喜欢打台球、健身,偶尔打打电子游戏,虽然内向,但我的朋友还是很多的,也喜欢交朋友,同时在这一年的学习生活中,我也希望自己可以得到进步,在编程语言上,希望自己可以精通,当然我也会自己努力,每周至少花8个小时的时间去学习这门课程,至于想去哪家公司,现在还没有想好,现在想的只是有人要我就行了,希望一年后的自己会有所改变。

  1. 打印100~200 之间的素数
#include<stdio.h>
#include<stdlib.h>

int isprime(int x) {
	int num = 2;
	while (num < x){
		if (x % num == 0){
			return 0;
		}
		num = num + 1;
	}
	return 1;
}
int main(){
	int i = 100;
	while (i < 200){
		if (isprime(i) == 1)
			printf("%d\n", i);
		i = i + 1;
	}
	system("pause");
}
  1. 输出乘法口诀表
#include<stdio.h>
#include<stdlib.h>
int main(){
	int line = 1;
	while (line < 10){
		int col = 1;
		while (col <= line){
			printf("%d*%d=%d", col, line, col*line);
			col += 1;

		}
		printf("\n");
		line += 1;
	}
       system("pause");
	
}
  1. 判断1000年—2000年之间的闰年
#include<stdio.h>
#include<stdlib.h>
int   isleapyear(int year)
{
	if (year % 100 == 0)
	{
		if (year % 400 == 0){
			return 1;
		}

		else{
			return 0;
		}
	}
	else{
		if (year % 4 == 0){
			return 1;
		}
		else{
			return 0;
		}
	}
}
int main(){
	int year = 100;
	while (year <= 2000){
		if (isleapyear(year) == 1){
		printf("%d\n", year);	
		}
         year += 1;
	}
	
	system("pause");
}

猜你喜欢

转载自blog.csdn.net/ytl1427698367/article/details/82918943
今日推荐