在while中count++和++count

2023-12-26 22:35:17
#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
main()
{
	int a, s, n, count;
	a = 2; s = 0; n = 1; count = 1;
	while (count <= 7)
	{ 
		n = n * a; 
		s = s + n;
		count++;
	}
	printf("s=%d",s);
}

#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
main()
{
	int a, s, n, count;
	a = 2; s = 0; n = 1; count = 1;
	while (count <= 7)
	{ 
		n = n * a; 
		s = s + n;
		++count;
	}
	printf("s=%d",s);
}

结果是一样的

文章来源:https://blog.csdn.net/2302_80472547/article/details/135224301
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。