我成为程序员的第一步

#include<stdio.h>
#include<string.h>
#include<math.h>

//int max(int x,int y)
//

//	return x>y?x:y;
//}



//十个数中的最大数
int main()

{
	int a[10]={0,1,2,33,4,5,6,7,8,9};
	int max = 0;
	int i = 0;
	//for(i=0;i<10;++i)
	//{
	//	scanf("%d",a[i]);
	//}
	for( i=0;i<10;++i)
	{
		if(max <= a[i])
		{
			max = a[i];
		}
	}


	printf("max=%d\n",max);

	
	return 0;

}
/*
//返回值参数值唯1的个数
int main()    //  Have error
{
	int n=12;
	//int j = 0;
	//scanf("%d",&n);
	int count = 0;
	while(n)
	{
		if(n % 2 == 1 )
		{
			count++;	
		}	
		n = n / 2;
	}
	
	//printf("j    =%d \n",1%2);
	printf("count=%d \n",count);
	//printf("j    =%d \n",j);
	return 0;
}







/*
//判断一个数是否为素数

int main()//su shu

{
	int i = 100;
	int j = 2;
	for(i=100;i<=200;++i)
	{
		for(int j=2;j < sqrt(i);++j)
		{
			if(i % j == 0)
			{
				break;
			}
			

		}
		if(j > sqrt(i))
			{
				printf("%d是素数!\n",i);
			}
			if(j <= sqrt(i))
			{
				printf("%d不是素数!\n",i);
			}
			
		
	}

	return 0;
}*/





//乘法表
/*int main()
{
	int i = 1;
	int j = 1;
	int s = 0;
	for(i=1;i<=9;++i)
	{	for(j=1;j<=i;++j)
		{
			s = i * j;
			printf("%d*%d=%d\t",i,j,s);
		}	
	
		printf("\n");
	}
	return 0;
}





/*
int main()
{								
	int ch;
									
	int line = 1;
									
	int flag = 1;//状态
									
	while((ch = getchar()) != EOF)
									
	{
										
		if(flag==1)
										
		{
											
			printf("%d",line);				
			flag = 0;
		}
		if(flag==0)
		{
			printf("%c",ch);	
		}
		if(ch == '\n')
		{
			line = line + 1;
			flag = 1;
		}
									
	}
									
	return 0;
								
}



/*
//花括号匹配
int main ()
{
	int ch;
	int count = 0;

	while((ch = getchar()) != EOF )
	{
		if(ch = '{')
		{
			count++;
		}
		else if(ch = '}' && count != 0)
		{
			count--;
		}
		else if(ch = '}' && count ==0)
		{
			printf("unmatch\n");
			return 0;
		}
	}
	if(count == 0)
	{
	printf("match\n");

	}
	else
	{
	    printf("unmatch\n");

	}
	return 0;
}




/*
//俩个数的值交换
int main ()
{
	int x = 6;
	int y = 7;
	int z = 0;
	//z = x + y;
	//x = z - x;
	//y = z - x;
	z = x * y;//x不等于0
	x = z / x;
	y = z / x;
	printf("x=%d,y=5d",x,y);
	return 0;
}*/




感想:需更加努力,认真编程


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值