v1<-c(2,3,4,5,6,10,8) oddcount<-0 evencount<-0 if(length (v1)>0) { for(i in v1 ) { if(i%%2==0) { evencount<-evencount+1 }else{ oddcount<-oddcount+1 } } print(paste("Total even number in vector is",evencount)) print(paste("Total odd number in vector is",oddcount)) }else{ print("Your vector is empty") } prgm 2 names<-c(4,3,2) var = readline ("Enter vector element to search:") flag<-FALSE for(i in names) { if(var==i) { flag<-TRUE break } } if(flag==TRUE) { print("Your searched element is present in vector") }else{ print("Your searched element is not present in vector") }