在我的程序中,我认为我的count变量没有保持该值.我该怎么办才能举办?这是我的代码.
static void Main(string[] args)
{
double a;
double count = 0;
Console.WriteLine("Enter the Numbers : ");
for (double i = 1; i <= 10; i++)
{
a = Convert.ToDouble(Console.ReadLine());
if (a % 2 != 0 || a % 3 != 0 || a % 5 != 0)
{
count = count++;
}
//else
//{
// }
Console.ReadLine();
}
Console.WriteLine("The Numbers That Are divisible by 2,3,5 are : " + count);
Console.ReadLine();
}
Run Code Online (Sandbox Code Playgroud) 我在一个程序的干运行中遇到了问题.我不明白为什么我的程序在输出中给出0.这是我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Task_8_Set_III
{
class Program
{
static void Main(string[] args)
{
int i = 3;
int c = i / fact(i);
Console.WriteLine("Factorial is : " + c);
Console.ReadLine();
}
static int fact(int value)
{
if (value ==1)
{
return 1;
}
else
{
return (value * (fact(value - 1)));
}
}
}
}
Run Code Online (Sandbox Code Playgroud)