Program to print 9 88 777 6666 55555 444444 3333333 22222222 111111111 #include using namespace std; int main() { int i,j,n; cin>>n; for(i=n; i>=1; i–){ for(j=i;j

Home » Archives for September 2017

# Month: September 2017

Calculate the gross salary using shell script Write a shell script for finding Gross Salary of Ramesh if DA and HRA is 40% and 20% #!/bin/bash (bash copy) read -p "Enter salary: " sal gros_sal=`echo "$sal*0.40+$sal*0.20" | bc -l` echo "Gross Salary is: $gros_sal"

Sum of digits of Number find sum of digits of number using shell how we will calculate Let’s code #!/bin/bash read -p "Enter the number: " num sum=0 while ((num != 0)) do b=$((num%10)) num=$((num/10)) let sum+=$b done echo "Sum of digits are: " $sum That was all about the shell or we can say it sum of digits of number using shell for more about shell script and once more

Check two files are same or not coderinme Check two files are same or not? What does this mean! File comparison If you have a large file or a large number of files and you want to compare it without view, then the following code is written in the shell script Please make note that This is the question often found on every assignment of linux and shell programming. now let’s code ” Check two files are same or not” #!/bin/bash …

Funny String Hackerrank Suppose you have a String, S, of length N that is indexed from 0 to N-1. You also have some String, R, that is the reverse of String S. S is funny if the condition S[i] – S[i-1] = R[i] – R[i-1] is true for every character from 1 to N-1. Note: For some String S, S[i] denotes the ASCII value of the ith 0-indexed character in S. The absolute value of an integer, x, is written …

PHP Program Sum of 2 numbers It’s very good language .it is also used in webdesign and code very dynamic language. PHP Program Sum of 2 numbers <?php function solveMeFirst($a,$b){ // this function return the sum return $a+$b; } $handle = fopen ("php://stdin","r"); // code to take input and store it into a and b $_a = fgets($handle); $_b = fgets($handle); //function call $sum = solveMeFirst((int)$_a,(int)$_b); //output we can write also echo $sum; print ($sum); fclose($handle); ?> output 5 3 …

Before going to the complex examples and facts about recursion, let’s begin with the basic to understanding the Recursion by knowing its definition and few conditions. Recursion is the method which call itself again and again until it meets the base condition. Recursion has two conditions- Base Condition(breaking condition) Recursive Condition For example, Understand the Recursion: Pros Factorial of a number is: Now on the basis of recursive function, Base condition: if(n==0) { return 1; } Recursive Condition: …