1) Fibonacci Series
2) Factorial of given no
3) Print your name in pattern format(example name= sathya) s
s a
s a t
s a t h
s a t h y
s a t h y a
4) Print the given string " Today is Friday " as "Friday is Today "
2) Factorial of given no
3) Print your name in pattern format(example name= sathya) s
s a
s a t
s a t h
s a t h y
s a t h y a
4) Print the given string " Today is Friday " as "Friday is Today "
These 4 programs are generally asked in Technical round 1 & 2 and some puzzle solving. First two problem already i solved in my previous post and for last 2 below you get the coding. You can solve it in any language what ever you know...I'm doing this with java it is so simple code and understand.
3) class Pattern
{
public static void main(String arg[])
{
String s="Sathya";
int n=s.length(); (length is 6)
for(int i=0;i<n;i++)
{
for(int j=0;j<=i;j++)
{
System.out.print(s.charAt(j));(get char one by one)
}
System.out.println("");
}
}
}
4) class Example
{ Output:
public static void main(String arg[]) Friday is Today
{
String s="Today is Friday";
String st[]=s.split("\\s"); (split the string based on space)
int n=st.length;
for(int i=n-1;i>=0;i--)
System.out.print(st[i]);
}
}
More Questions Coming Soon................
No comments:
Post a Comment