Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
25 changes: 25 additions & 0 deletions divide_reverse_count/divide_reverse_count.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "divide_reverse_count", "divide_reverse_count\divide_reverse_count.csproj", "{EAF6365A-AE6C-47DC-B642-B010FD28054D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EAF6365A-AE6C-47DC-B642-B010FD28054D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EAF6365A-AE6C-47DC-B642-B010FD28054D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAF6365A-AE6C-47DC-B642-B010FD28054D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAF6365A-AE6C-47DC-B642-B010FD28054D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8D3D0E0D-AAC3-4E9B-863A-9B3235DADCBB}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions divide_reverse_count/divide_reverse_count/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
245 changes: 245 additions & 0 deletions divide_reverse_count/divide_reverse_count/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace divide_reverse_count
{
class Program
{
static void Main(string[] args)
{
// Console.WriteLine(Reverse(1234));
//Console.WriteLine(divide(36));
//Console.WriteLine(count(12345));
//Console.WriteLine(countreverse(123456));
//Console.WriteLine(evencount(123));
//Console.WriteLine(amstrong(153));
//Console.WriteLine(firstdigit(123456));
// Console.WriteLine(lastdigit(123456));
//Console.WriteLine(firstlast(12351));
//Console.WriteLine(palindrome(6226));
//if (IsPrime(6)==true)
//{
// Console.WriteLine("is prime");
//}
//else
//{
// Console.WriteLine("not prime");
//}
// Console.WriteLine(SumOFPrimeNumberless(20));

Console.WriteLine(SumOFPerfectSquare(30));
}
public static int Reverse(int n)
{
int rev = 0;
while (n > 0)
{
int temp = n % 10;
rev = rev * 10 + temp;
n = n / 10;
}
return rev;
}
public static bool divide(int n)
{
int temp = n % 10;
if (n % temp == 0)
{
return true;
}
return false;
}
public static int count(int n)
{
int count = 0;

while (n > 0)
{
n = n / 10;
count++;
}

return count;

}
public static int countreverse(int n)
{
int count = 0;
int rev = 0;
while (n > 0)
{
int temp = n % 10;
rev = rev * 10 + temp;
n = n / 10;
count++;
}

return count;
}
public static int evencount(int n)
{

int count = 0;
int evencount = 0;
int oddcount = 0;
// int rev = 0;
while (n > 0)
{
int temp = n % 10;
// rev = rev * 10 + temp;
n = n / 10;
if (temp % 2 == 0)
{
evencount++;
Console.WriteLine("even:" + evencount);
}
//return evencount;
else if (temp % 2 != 0)
{
oddcount++;
Console.WriteLine("odd:" + oddcount);
}

}
return count;
}
public static bool amstrong(int n)
{
bool Flag = true;
int count;
count = (int)(Math.Log10(n) + 1);
double sum = 0;
int rem;
int temp = n;
while (n != 0)
{
rem = n % 10; ;
sum = sum + (Math.Pow(rem, count));
n = n / 10;
}
if (sum == temp)
{
return Flag;
}
else
{
return false;
}
}
public static int firstdigit(int n)
{
while (n > 10)
{
n = n / 10;
}
return n;
}
public static int lastdigit(int n)
{
n = n % 10;
return n;
}
public static bool firstlast(int n)
{
bool flag = true;

if (firstdigit(n) == lastdigit(n))
{
return flag;
}
return false;

}
public static bool palindrome(int n)
{
bool flag = true;
int reverse = 0;
int rem;
int temp = n;
while (n > 0)
{

rem = n % 10;
reverse = reverse * 10 + rem;
n = n / 10;
}
if (temp == reverse)
{
return flag;
}
else
{
return false;
}
}
public static bool IsPrime(int n)
{

bool flag = true;
if (n <= 1)
{
return false;
}
if (n == 2)
{
return flag;
}
// for (int i = 2; i < Math.Sqrt(n) + 1; i++)
int i = 2;
while (i < Math.Sqrt(n) + 1)
{
if (n % i == 0)
{
flag = false;
}
i++;
}
return flag;
}
public static int SumOFPrimeNumberless(int n)
{

// bool flag = true;
int sum = 0;
for (int i = 2; i <= n; i++)
{
if (IsPrime(i))
{
// Console.WriteLine(i);
sum += i;
}
}
return sum;
}
public static bool IsPerfectSquare(int n)
{
bool flag = true;
double x = Math.Sqrt(n);
double y = Math.Round(x);
if (x - y == 0)
{
return flag;
}
else
{

return false;
}
}
public static int SumOFPerfectSquare(int n)
{
int sum = 0;
for (int i = 1; i <= n; i++)
{
if (IsPerfectSquare(i))
{
sum = sum + i;
}
}
return sum; ;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("divide_reverse_count")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("divide_reverse_count")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("eaf6365a-ae6c-47dc-b642-b010fd28054d")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EAF6365A-AE6C-47DC-B642-B010FD28054D}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>divide_reverse_count</RootNamespace>
<AssemblyName>divide_reverse_count</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e94166f8473d37a7088a8641e0119a67f8219728
Binary file not shown.