c# - Error: 'Flow': member names cannot be the same as their enclosing type -
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace cofbalu { class strongno { static int factorial(int rem) { if (rem == 1) return 1; else return factorial(rem - 1) * rem; } static int strongno(int n) { int rem=0,strong=0; while (n > 0) { strong = strong + factorial(rem = n % 10); n = n / 10; } return strong; } static void main() { console.write("enter no: "); int n = int.parse(console.readline()); if (strongno(n) == n) console.write("yes, "+n+" strong no."); else console.write("no, " + n + " not strong no."); console.readline(); } } }
your method static int strongno(int n)
having same name class name. , method name have name of class called constructor. , constructors not have return type.
so can try rename function this:
static int strongnumber(int n)
Comments
Post a Comment