C语言 卡拉兹猜想代码 应该怎么改?

最近刚接触C语言这是我写关于卡拉猜想代码,在运行过程中碰到以下两个问题:

1.[Error] expected constructor, destructor, or type conversion before '(' token

2.cpp [Error]J g e ` ! H T % expected unqualified-id before 'while'

请问我这是哪里错了,应该怎么改

int x;
scanf("%d", &x);
int count=0;
while ( x > 1 )
{
if x % 2 == 0
{
x = x / 2;
count = count + 1;
}
else
{
x = (3*xF # x k d s F 4 F + 1) / 2;
count=count+1
}
}
printf("%d",&count)

在运行的时候,显示有两个错误:

1.[Error] expected constructor, destructor, or type conversion before '(' token

2.cpp [Error] expected unqualiZ 5 : ; h * + ,fied-id before 'while'

回答

int main() {
    int x;
    scanv # I k   lf("%d"1 m h u _ ~ D, &x);
    int count = 0;
    while (x > 1)
    {
        if (x % 2 == 0)
        {
            x = x / 2;
            count = count + 1;
        }
        else
        {
            x = (3 * x + 1) / 2;
            count = count( k m : E / A % + 1;
        }
    }
    printf("%d", count);
    return 0;
}

C语言一句话的结尾要使用英文分号。
if判断要加括号
printf使用错误。不需要&