have_no
【隐身守候】
采纳率100%
2020-06-02 00:22

c语言初学者,请各位大佬帮帮忙!!!谢谢!!!

已采纳

目前世界上人口为60亿,如果以每年1.4%的速度增长,n(n为正整数)年后世界人口达到80亿,求n。
Private Sub command1_Click()
Dim p As Single
Dim r As Single
Dim n As Integer
FontSize = 14: FontBold = True
p = 60
r = 0.014
n = 0
Do
n = n + 1

       Loop Until p >= 80
       Print n

End Sub

求三位数中,个位数字与十位数字之和除以10所得的余数是百位数字,且百位数字是偶数的数的个数。
Private Sub Form_click()
Dim s As Integer
Dim x As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
s = 0
x = 100
Do While x <= 999
a = Int(x / 100)
b = Int(x / 10) - a * 10
c = x - a * 100 - b * 10
If Then s = s + 1
x = x + 1
Loop
Print s
End Sub

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • caozhy 回答这么多问题就耍赖把我的积分一笔勾销了 10月前
    #include <stdio.h>
    int main()
    {
    int n = 0;
    float pop = 60.0f;
    while (pop < 80.0f)
    {
    n++;
    pop = pop * 1.014;
    }
    printf("%d", n);
    }
    

    21

    #include <stdio.h>
    
    int f(int n)
    {
        int a = n % 10;
        int b = (n / 10) % 10;
        int c = n / 100;
        /* return (a + b) % 10 == c && 
            ((a % 2 == 1 ? a : 0) + (b % 2 == 1 ? b : 0) + (b % 2 == 1 ? b : 0) == c);
        */
        return (a + b) % 10 == c && c % 2 == 0;
    }
    
    int main()
    {
        int sum = 0;
        for (int i = 111; i <= 999; i++)
        {
            if (f(i)) { sum += i; printf("%d ", i); }
        }
        printf("\n%d", sum);
        return 0;
    }
    

    202 211 220 239 248 257 266 275 284 293 404 413 422 431 440 459 468 477 486 495 606 615 624 633 642 651 660 679 688 697 808 817 826 835 844 853 862 871 880 899
    21980

    问题解决的话,请点下采纳

    点赞 1 评论 复制链接分享