nandagirisaipranay
BAN USERimport java.util.Scanner;
public class ArraryMatrix {
static int count;
/**
* @param args
*/
public static int Mat(int arr[][],int size){
for(int i=0;i<size;i++){
for(int j=0;j<size;j++){
if(arr[i][j]==0){
count+=1;
}
}
}
return count;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("Enter the dimension of the Array:-");
int len=sc.nextInt();
int [][]A=new int[len][len];
for(int i=0;i<len;i++){
for(int j=0;j<len;j++){
System.out.println("Enter the element:["+i+"]"+"["+j+"]");
A[i][j]=sc.nextInt();
}
}
int score=Mat(A,len);
System.out.println("There are --"+score+"---No of zros are present in the given Matrics");
}
}
public class Union {
/**
* @param args
*/
String s="";
int count;
public void takes(String s1,String s2){
for(int i=0;i<s1.length();i++){
char temp=s1.charAt(i);
if(s2.indexOf(temp)!=-1){
s=s+temp;
System.out.println(s);
}
else{
count=count+1;
}
}//end of for
if(count==s1.length()){
System.out.println("NO----------------------------------");
return ;
}
String A=s1.replace(s,"");
String B=s2.replace(s,"");
System.out.println(A+B);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Union u=new Union();
String s1="abcd";
String s2="cdgh";
u.takes(s1, s2);
}
}
import java.util.LinkedList;
import java.util.Queue;
public class BinaryPal {
public static void printNum(int n){
Queue q = new LinkedList();
q.add("1");
while(n!=0){
n--;
String s1=(String) q.peek();//retrives the node's value but do not removes it
q.poll();//gets the first node and removes it from the queue
//System.out.println(s1);
String temp=new StringBuffer(s1).reverse().toString();
if(temp.equals(s1)){
System.out.println(s1);
}
String s2=s1;
q.add(s1.concat("0"));
q.add(s2.concat("1"));
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int n=10;
printNum(100);
}
}
import sys
a=input("Enter for pain:")
b=input("Enter again:")
res=0
t=b-a
c=abs(t)
list=[]
for i in range(0,4):
p=input("Enter the ele")
list.insert(i,p)
print"Loop completed"
for j in range(0,4):
res=res+abs(list[j]-c)
print "the result is",res
import sys
list=["dog","frog","cat"]
use=raw_input("Enter the input string ")
for x in range(0,(len(list)-1)) :
for y in range(0,(len(use)-1)):
if use[y:y+2] == list[x]:
score=score+1
if score==3:print "100%"
elif score==2:print "66%"
elif score==1:print"33%"
else :print"--0%--"
attach the last to the first then 1 -> 2 -> 3-> 4-> 5 becomes
- nandagirisaipranay December 12, 20161->5 -> 2 -> 3-> 4, do the same procedure for the rest of the chain (2-> 3-> 4)