Blog

QUICK ENQUIRY FORM



WHAT WILL HAPPEN WHEN YOU SUBMIT THIS FORM

  • After submitting the enquiry, you will be contacted by our team.
  • Payilagam Team will get to know about your training needs.
  • They will update you how could they help you.
  • Trainers(IT Professionals) may contact you if you need any clarification.
  • Your contact information will be kept highly confidential & not be shared to 3rd Parties.
Quick Enquiry

Find Even or Odd without using if and switch case

Hi Friends, Today, we are going to find Even or Odd Without using if and switch case.  The question asked here is – Write a program to find out if the given number is odd or even without using conditional statement like if or switch case. Solution : It is mentioned that We should not use if and switch case.  That is the clue we should remember here.  Hence, for finding out odd or even without those, we can go for array concept.  Let me try a simple Java program with a String array which consists of just two elements. Declare the two string values in the array with index o and 1. o => Even 1=> Odd Any number divide with two its give remainder as o or 1.  Thus, this remainder can be used in array index value. Program: public class EvenOdd { public static void main(String[] args) { String evenOdd[] = {“Even”,”Odd”};  // String array with only two elements int number = 3; int remainder= number % 2;  // remainder is calculated. System.out.println(evenOdd[remainder]); } } Output: Odd

By |August 13th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 12

Hi Guys, In this post, our intention is to create Z Pattern (see below).  Already in our previous posts, we learnt X and Y Patterns.  Here our focus would be on creating the below pattern. package pattern.aug; public class ZPattern { public static void main(String[] args) { // TODO Auto-generated method stub //1st line for(int i=0;i<5;i++) { System.out.print(“*”); } System.out.println(); //2nd line for(int i=0;i<3;i++) { System.out.print(” “); } System.out.print(“*”); System.out.println(); //3rd line for(int i=0;i<2;i++) { System.out.print(” “); } System.out.print(“*”); System.out.println(); //4th line for(int i=0;i<1;i++) { System.out.print(” “); } System.out.print(“*”); System.out.println(); //5th line for(int i=0;i<5;i++) { System.out.print(“*”); } } } Output: 

By |August 10th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 11

Shall we try Y Pattern today through a Java Program?  The need is, we should bring Program: package pattern.aug; public class Ypattern { public static void main(String[] args) { // TODO Auto-generated method stub //1stline System.out.print(“*”); for(int i=0;i<5;i++) { System.out.print(” “); } System.out.print(“*”); System.out.println(); //2nd line System.out.print(” “); System.out.print(“*”); for(int i=0;i<3;i++) { System.out.print(” “); } System.out.print(“*”); System.out.println(); //3rd line for(int i=0;i<2;i++) { System.out.print(” “); } System.out.print(“*”); System.out.print(” “); System.out.print(“*”); System.out.println(); //remaining lines int n=0; while(n<3){ int row=0; while(row<3-n) { System.out.print(” “); row++; } System.out.print(“*”); System.out.println(); n++; } } } Output:

By |August 10th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 10

Hi, In today’s post, we discuss about printing X pattern.  Already we know how to use looping statements in Java.  Here I am using while – nested while looping statements to derive X pattern.  The expected output is X Pattern Program public class XPattern { public static void main(String[] args) { int i=0,j; while(i<3){ j=0; while(j<(i*1)){ System.out.print(” “); j++; } int k=0; while(k<=(i-i)){ System.out.print(“*”); k++; } k=0; while(k<(4-(2*i))){ System.out.print(” “); k++; } k=0; while(k<=(i*0)){ System.out.print(“*”); k++; } System.out.println(); i++; } i=1; while(i>=0){ j=0; while(j<(i*1)){ System.out.print(” “); j++; } int k=0; while(k<=(i*0)){ System.out.print(“*”); k++; } k=4; while(k>(i*2)){ System.out.print(” “); k–; } j=0; while(j<=(i*0)){ System.out.print(“*”); j++; } System.out.println(); i–; } }} Output:

By |August 10th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 9

In this series, probably this could be the toughest program I ever tried.  Already our colleague Srilatha Akka shared the logic for this program in the previous post  in C Language to solve this problem.  Well, First of all – What is the problem to be solved?  Let me share you that! The above pattern should be printed.  I am sharing my logic here with for deriving the above pattern here with. ABCD Pattern Program in Java public class AsciiTry { public static void main(String[] args) { int i=0,j,k,r,s,l,m; while(i<5){ j=0; while(j<(i*1)){ System.out.print(” “); j++; } k=0; while(k<=(i*0)){ r=65+i; System.out.printf(“%c”,r); k++; } l=0; while(l<7-(i*2)){ System.out.print(” “); l++; } m=0; while(m<=(i*0)){ s=73-i; if(s==69) break; System.out.printf(“%c”,s); m++; } l=7; while(l>7-((i*2)-1)){ System.out.print(” “); l–; } k=0; while(k<=(i*0)){ r=73+i; if(r==73){ break; } System.out.printf(“%c”,r); k++; } l=0; while(l<7-(i*2)){ System.out.print(” “); l++; } m=0; while(m<=(i*0)){ s=81-i; if(s==77) break; System.out.printf(“%c”,s); m++; } l=7; while(l>7-((i*2)-1)){ System.out.print(” “); l–; } k=0; while(k<=(i*0)){ r=81+i; if(r==81) break; System.out.printf(“%c”,r); k++; } l=0; while(l<7-(i*2)){ System.out.print(” “); l++; } m=0; while(m<=(i*0)){ s=89-i; if(s==85) break; System.out.printf(“%c”,s); m++; } l=7; while(l>7-((i*2)-1)){ System.out.print(” “); l–; } k=0; while(k<=(i*0)){ r=89+i; if(r==89) break; if(r==91) break; if(r==92) break; if(r==93) break; System.out.printf(“%c”,r); k++; } System.out.println(); i++; } } }

By |August 6th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 8

This is one of the toughest questions, we discussed in our Programming class.  I spent almost 3 hours (or even more than that) to solve the below program.  My trainer asked to work on printing the below pattern program. I wrote in C language.  Please go through the program below.  As it is mainly dealing with looping statements, you can make use of the same logic in any programming language like Java, C#, etc. #include<stdio.h> #include<conio.h> void main() { int i,j,k,l,m,z=1,n,o,p,q,r,s,t,u,v,w; clrscr(); for(i=1;i<=5;i++) { for(j=1;j<i;j++) { printf(” “); } for(k=1;k<=z;k++) { printf(“%c”, i+64); } for(l=1;l<=9-(2*i);l++) { printf(” “); } for(m=1;m<=z;m++) { if(i==5){ break;} printf(“%c”, 74-i); } for(n=1;n<(2*i)-2;n++) { printf(” “); } for(o=1;o<=z;o++) { if(i==1){break;}; printf(“%c”,i+72); } for(p=1;p<=9-(2*i);p++) { printf(” “); } for(q=1;q<=z;q++) {  if(i==5){break;} printf(“%c”,82-i); } for(r=1;r<(2*i)-2;r++) { printf(” “); } for(s=1;s<=z;s++) { if(i==1){break;} printf(“%c”,i+80); } for(t=1;t<=9-(2*i);t++) { printf(” “); } for(u=1;u<=z;u++) { if(i==5){break;} printf(“%c”,90-i); } for(v=1;v<(2*i)-2;v++) { printf(” “); } for(w=1;w<=z;w++) { if(i==2){ printf(“%c”,i+88); }} printf(“\n”); } getch(); }

By |August 6th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 7

Learn Programming through funny ways!  Here, we are going to solve Profit and Loss related Aptitude through our Logical Thinking series. QUESTION A, B, C subscribe Rs. 50,000 for a business. A subscribes Rs. 4000 more than B and B Rs. 5000 more than C. Out of a total profit of Rs. 35,000.  How much does A receive? ANSWER:  14700 ALGORITHM Get the total profit value from user Initialize a=4000,b=5000,amt=50000 Add the value of and b to get the a’s original amount Then add the a’s original amount and the b value and subtract it from amt and store it in cvalue Then divide the cvalue by 3 Find the a&b value by adding cvalue with a’s original amount and b value Find the ratio of a,b,c by dividing the a,b,c value by 1000 Now add the a,b,c ratios to get the total value Now find a’s share by multiplying profit value with a’s ratio and divide dy the total value Profit Share Program in Java package my.app2; import java.util.Scanner; public class App2 { public static void main(String[] args) { System.out.println(“enter the total profit”); Scanner scanner = new Scanner(System.in); int p = scanner.nextInt(); int a=4000,b=5000; int a_modval=a+b, a_share, cvalue_by_ab; int amt=50000, cValue,a_amount,b_amount,a_ratio,b_ratio,c_ratio,totalRatio; int sumOffab+a_modval; cValue_by_ab=amt-sumOfab; cValue=cValue_by_ab/3; a_amount=cValue+a_modval; b_amount=cValue+b; a_ratio=a_amount/1000; b_ratio=b_amount/1000; c_ratio=cValue/1000; totalRatio=a_ratio+b_ratio+c_ratio; // Calculating a’s share now.  a_share=(p*a_ratio)/totalRatio; System.out.print(“a’s share is: “+a_share); } }

By |August 6th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 6

Today, we are going to learn about Pattern Programs here.  The given pattern to be printed is 4444 333 22 1   PATTERN PROGRAM package task.my.pro; public class PatternProgram{ public static void main(String[] args) { int no=4,round=0; do{ int column=0,row=0; while(column<4-round) { //Printing no value below System.out.print(no); column++; } no–; // Moving to next line System.out.println(” “); round++; do { System.out.print(” “); row++; }while(row<round); }while(round<4); } }   OUTPUT 4444 333 22 1

By |August 6th, 2017|Blogs|0 Comments

Learn Programming through Logical Thinking Series – 5

Let us have fun on our Learn Programming through Logical Thinking Series – 5 here. Question for Logical Thinking: A, B and C jointly thought of engaging themselves in a business venture. It was agreed that A would invest Rs.6500 for 6 months, B Rs.8400 for 5 months and c, Rs.10000 for 3 months. A wants to be the working member for which he was to receive 5% of the profits, The profit earned was Rs.7400. Calculate the share of B in the profit. Answer: A’s investment amount for months =Rs.6500 for 6 months = Rs.39000 B’s investment amount for months =Rs.8400 for 5 months = Rs.42000 C’s investment amount for months =Rs.10000 for 3 months = Rs.30000 Total profit is Rs.7400. A also get 5% of his profit.  So, We can subtract that amount from total profit A’s getting profit =  ×5 =370.  Remaining profit = 7400-370=7030 Now, we can find the ratio of  A B and C 39000  :  42000  :  30000, Common  by 3, so divided by 3000 We get 13  :  14  :  10 After we find total Ratio value = 13+14+10 = 37 Now we can find the B’s share = ×Remaining profit =  ×7030 Now, we get the value of B’s Share = Rs.2660 Shall we write the same as Java Program Program : public class BShareProfit{ public static void main(String[] args) { int invest1=6500,invest2=8400,invest3=10000,m1=6,m2=5,m3=3; double totInvest1,totInvest2,totInvest3; double totProfit=7400,percent=5,value,getProfit,remProfit; double b_ratio1,b_ratio2,ratio,ratio1,ratio2,ratio3,b_share; totInvest1 = invest1*m1; totInvest2 = invest2*m2; totInvest3 = invest3*m3; //find ratio ratio1=totInvest1/3000; ratio2=totInvest2/3000; ratio3=totInvest3/3000; ratio=ratio1+ratio2+ratio3; value=totProfit/100; getProfit=value*5; remProfit=totProfit-getProfit; //find B’s share b_ratio1=remProfit/ratio; b_share=b_ratio1*ratio2; System.out.println(“B’s Share is ” +b_share); } }

By |August 6th, 2017|Blogs|0 Comments

GIT – Account Creation and Creating Remote Repository

Open https://github.com/ Click on ‘Sign Up’ Provide credentials and create account Now, ‘Unlimited public repositories for free’ is selected by default. Leave as it is. Click ‘Continue’ Step 3 is optional. You can skip that.  If you want to add details about your personal interests, please fill up those details there. Click ‘Submit’ Now, you will be directed to Dashboard page as below. Click on ‘Start a project’ now. Now, Provide Repository name Description is optional. You can add comments or leave as blank. Don’t forget to check ‘Initialize this repository with a README’ Click ‘Create Repository’ Now, you will be directed to the newly created repository page as below. It will show a prompt asking for Login Credentials again. Provide your git Username and Password again.