Wednesday, March 28, 2012
ஜாவா புரோகிராமிங்-மாணவர்களுக்கு உதவும் எளிய நிரல்கள்
Wednesday, March 28, 2012 by Samsutheem Muhammadh Jahan
ஜாவாவில்
எளிய முறையில் சில கணிதங்களை பயன்படுத்த நிரல்களை கீழேதந்துள்ளேன். பள்ளி
மற்றும் கல்லூரி மாணவர்களுக்கு உதவியாக இருக்கும்.
1.ஒரு முழு எண்ணில் உள்ள எண்களின் கூடுதல் கண்டறிய...
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n=0,n1,n2=0,i,x;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=0;i<n;i++)
{
x=n/10;
n1=n%10;
n2=n2+n1;
n=x;
}
System.out.Println(“Sum of the given Number is :” + n2);
}
}
2.கொடுக்கப்பட்ட முழு எண்ணின் தலைகீழ் எண் ( Reverse No ) கண்டறிய...
import java.io.*;
public class reverse
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,n1,i,x;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=0;i<n;i++)
{
x=n/10;
n1=n%10;
n=x;
}
System.out.Println(“Reverse of the given Number is :” + n1);
}
}
3.ஒரு முழு எண் ஆம்ஸ்ட்ராங் எண்ணா (Armstrong) என்று கண்டறிய...
import java.io.*;
public class Armstrong
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,n1,i,q=0,sum=0;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
n1=n;
while(n!=0)
{
q=n%10;
sum=sum+(q*q*q);
n=n/10;
}
if (n1==sum)
{
System.out.Println(“the given Number is Armstrong”);
}
else
{
System.out.Println(“the given Number is not Armstrong”);
}
}
}
4.பத்தடிமான எண்ணிலிருந்து ஈரடிமான எண்ணாக மாற்ற ( Decimal to Binary )
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,n1,n2,i,x[50];
System.out.Println(“Enter the Decimal number”);
n=Integer.parseInt(in.readLine());
for(i=0;i<n;i++)
{
n1=n/2;
n2=n%2;
x[i]=n2;
n=n1;
}
for(i=n;i>0;i--)
{
System.out.Println(+ x[i]);
}
}
}
5.ஒரு எண்ணின் Factorial மதிப்பு காண...
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,i,fac=1;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=1;i<=n;i++)
{
fac=fac*i;
}
System.out.Println(“The factorial of given Number is :” + fac);
}
}
6.Fibonacci தொடர்வரிசை காண...
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int f1=1,f2=1,f3,i,n;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=2;i<n;i++)
{
System.out.Println(+f1 , +f2);
f3=f1+f2;
f1=f2;
f2=f3;
}
}
}
Tags:
கணனி ,
தொழில் நுட்பம்
1.ஒரு முழு எண்ணில் உள்ள எண்களின் கூடுதல் கண்டறிய...
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n=0,n1,n2=0,i,x;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=0;i<n;i++)
{
x=n/10;
n1=n%10;
n2=n2+n1;
n=x;
}
System.out.Println(“Sum of the given Number is :” + n2);
}
}
2.கொடுக்கப்பட்ட முழு எண்ணின் தலைகீழ் எண் ( Reverse No ) கண்டறிய...
import java.io.*;
public class reverse
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,n1,i,x;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=0;i<n;i++)
{
x=n/10;
n1=n%10;
n=x;
}
System.out.Println(“Reverse of the given Number is :” + n1);
}
}
3.ஒரு முழு எண் ஆம்ஸ்ட்ராங் எண்ணா (Armstrong) என்று கண்டறிய...
ஆம்ஸ்ட்ராங்
என்றால் ஒரு எண்ணின் ஒவ்வொரு இலக்கத்தையும் கணமாக மாற்றி வரும் அதன்
கூட்டுத்தொகையும் அந்த எண்ணும் சமமாக இருக்க வேண்டும்.
(எ.கா) - 153 = 13+53+33=153import java.io.*;
public class Armstrong
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,n1,i,q=0,sum=0;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
n1=n;
while(n!=0)
{
q=n%10;
sum=sum+(q*q*q);
n=n/10;
}
if (n1==sum)
{
System.out.Println(“the given Number is Armstrong”);
}
else
{
System.out.Println(“the given Number is not Armstrong”);
}
}
}
4.பத்தடிமான எண்ணிலிருந்து ஈரடிமான எண்ணாக மாற்ற ( Decimal to Binary )
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,n1,n2,i,x[50];
System.out.Println(“Enter the Decimal number”);
n=Integer.parseInt(in.readLine());
for(i=0;i<n;i++)
{
n1=n/2;
n2=n%2;
x[i]=n2;
n=n1;
}
for(i=n;i>0;i--)
{
System.out.Println(+ x[i]);
}
}
}
5.ஒரு எண்ணின் Factorial மதிப்பு காண...
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int n,i,fac=1;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=1;i<=n;i++)
{
fac=fac*i;
}
System.out.Println(“The factorial of given Number is :” + fac);
}
}
6.Fibonacci தொடர்வரிசை காண...
import java.io.*;
public class sum
{
public static void main(String[] args)throws IOException
{
DataInputStream in= new DataInputStream(System.in);
int f1=1,f2=1,f3,i,n;
System.out.Println(“Enter the number”);
n=Integer.parseInt(in.readLine());
for(i=2;i<n;i++)
{
System.out.Println(+f1 , +f2);
f3=f1+f2;
f1=f2;
f2=f3;
}
}
}
Subscribe to:
Post Comments (Atom)


0 Responses to “ஜாவா புரோகிராமிங்-மாணவர்களுக்கு உதவும் எளிய நிரல்கள்”
Post a Comment