Aim:
To perform the palindrome program using c sharp.net application.Algorithm:
Step2: Type the program in new notepad file .
Step3: Create a class name as “pallin”
Step4: In the main function denote data type int
Step5: This program contains the formula to the reverse (rev) function as
D=n%10
Rev=rev*10+d
N=n/10
Step6: Save the program with the extension of .cs
Step7: Open the visual studio comment prompt to run the program.
Step8: Compile the program by using the command as program name.cs
Step9: Run the program by giving the program name
Step10: Stop the program.
PALINDROME PROGRAM
using System;
class Palin
{
public static void Main(string[] args)
{
int n,r,rev=0,m;
Console.Write("Enter the Number: ");
n = int.Parse(Console.ReadLine());
m=n;
while(n>0)
{
r=n%10;
rev=(rev*10)+r;
n=n/10;
}
if(m==rev)
Console.Write("Number is Palindrome.");
else
Console.Write("Number is not Palindrome");
}
}
OUTPUT:
BY
REGU RAM SV.
Other programs.
ReplyDeleteWithin few days bro.
DeletePost a Comment