发布网友 发布时间:2022-05-07 11:51
共1个回答
热心网友 时间:2023-10-30 06:04
main()
{
int i,sum=0;
for(i=1;i<=100;i++)
if(i%2==1) sum+=i;
printf("%d\n",sum);
i=1;
sum=0;
while(i<=100)
{
if(i%2==1) sum+=i;
i++;
}
printf("%d\n",sum);
}
DECLARE @sum int , @i int
SET @sum = 1
SET @i = 1
WHILE @i<=10
BEGIN
SET @sum = @sum+ @i
SET @i = @i + 1
END
PRINT @sum
热心网友 时间:2023-10-30 06:04
main()
{
int i,sum=0;
for(i=1;i<=100;i++)
if(i%2==1) sum+=i;
printf("%d\n",sum);
i=1;
sum=0;
while(i<=100)
{
if(i%2==1) sum+=i;
i++;
}
printf("%d\n",sum);
}
DECLARE @sum int , @i int
SET @sum = 1
SET @i = 1
WHILE @i<=10
BEGIN
SET @sum = @sum+ @i
SET @i = @i + 1
END
PRINT @sum
热心网友 时间:2023-10-30 06:04
main()
{
int i,sum=0;
for(i=1;i<=100;i++)
if(i%2==1) sum+=i;
printf("%d\n",sum);
i=1;
sum=0;
while(i<=100)
{
if(i%2==1) sum+=i;
i++;
}
printf("%d\n",sum);
}
DECLARE @sum int , @i int
SET @sum = 1
SET @i = 1
WHILE @i<=10
BEGIN
SET @sum = @sum+ @i
SET @i = @i + 1
END
PRINT @sum