Recent Articles

Free SkillRack Practice Programs
4 days ago

Are you looking to start campus placement preparation? We have picked must solve programs to kickstart your campus placement preparation. We have classified those programs into the following parts.

Please click the link below to solve the programs in part 1.
http://www.skillrack.com/article/126/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 2.
http://www.skillrack.com/article/127/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 3.
http://www.skillrack.com/article/128/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 4.
http://www.skillrack.com/article/129/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 5.
http://www.skillrack.com/article/130/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 6.
http://www.skillrack.com/article/131/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 7.
http://www.skillrack.com/article/132/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 8.
http://www.skillrack.com/article/133/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 9.
http://www.skillrack.com/article/134/Must-Solve-100-Programs-for-Campus-Placement-s

Please click the link below to solve the programs in part 10.
http://www.skillrack.com/article/135/Must-Solve-100-Programs-for-Campus-Placement-s

View

Printing N terms in Fibonacci series
4 days ago

The program must accept an integer N as the input. The program must print the first N terms in the fibonacci series as the output.

Boundary Condition(s):
3 <= N <= 30

Input Format:
The first line contains N.

Output Format:
The first line contains N integers representing the first N terms in the fibonacci series separated by a space.

Example Input/Output 1:
Input:
10

Output:
0 1 1 2 3 5 8 13 21 34

Example Input/Output 2:
Input:
5

Output:
0 1 1 2 3

The below video explains the logic and the implementation in C programming language to print N terms in the Fibonacci series.

Click the link below to solve this program
http://www.skillrack.com/solve/1617

View

Selection Sort in C Programming language
5 days ago

#include <stdio.h>

int main()
{
  int N;
  scanf("%d",&N);
  int arr[N];
  for(int index=0; index < N; index++){
    scanf("%d",&arr[index]);
  }

  for(int index=0; index < N; index++){
    int smallestValueIndex = index;
    for(int compareIndex = index+1; compareIndex < N; compareIndex++){
        if(arr[compareIndex] < arr[smallestValueIndex]){
            smallestValueIndex = compareIndex;
        }
    }
    int temp = arr[smallestValueIndex];
    arr[smallestValueIndex] = arr[index];
    arr[index] = temp;
  }

  for(int index=0; index < N; index++){
    printf("%d ",arr[index]);
  }

}

 

View

Must Solve 100 Programs for Campus Placement Part - 10/10
6 days ago

1) Sum of Even Digits

The program must accept an integer N as the input. The program must print the sum of even digits in the integer N as the output.

Example Input/Output 1:
Input:
1427

Output:
6

Example Input/Output 2:
Input:
519

Output:
0

Click the link below to solve this program
http://www.skillrack.com/solve/9247

2) Maximum Length - S1 and S2

The program must accept two string values S1 and S2 as the input. The program must print the string having the maximum length as the output. If both the string values having the same length then print both the string values in the given order as the output.

Boundary Condition(s):
1 <= Length of S1, S2 <= 100

Example Input/Output 1:
Input:
rack
skill

Output:
skill

Click the link below to solve this program
http://www.skillrack.com/solve/9248

3) Print Integers - Right to X

The program must accept N unique integers and an integer X as the input. The program must print all the integers right to the integer X (inclusive of X) as the output.
Note: The integer X is always present in the N integers.

Boundary Condition(s):
2 <= N <= 100
1 <= Each integer value, X <= 1000

Example Input/Output 1:
Input:
6
20 35 10 44 99 18
44

Output:
44 99 18

Click the link below to solve this program
http://www.skillrack.com/solve/9249

4) Print Last K Integers

The program must accept N integers and an integer K as the input. The program must print the last K integers among the N integers as the output.

Boundary Condition(s):
1 <= N <= 100
1 <= K <= N

Example Input/Output 1:
Input:
5
2 1 4 3 6
2

Output:
3 6

Click the link below to solve this program
http://www.skillrack.com/solve/9251

5) Integer Triangle - Pattern

The program must accept an integer N as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Boundary Condition(s):
2 <= N <= 50

Example Input/Output 1:
Input:
5

Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

Click the link below to solve this program
http://www.skillrack.com/solve/9250

6) Reverse Alphabet Triangle Pattern

The program must accept an integer N as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Boundary Condition(s):
2 <= N <= 26

Example Input/Output 1:
Input:
5

Output:
----a
---ba
--cba
-dcba
edcba

Click the link below to solve this program
http://www.skillrack.com/solve/9258

7) Special Characters - Pattern

The program must accept an integer N as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Boundary Condition(s):
2 <= N <= 100

Example Input/Output 1:
Input:
5

Output:
#----
*#---
**#--
***#-
****#

Click the link below to solve this program
http://www.skillrack.com/solve/9253

8) N Pattern

The program must accept an odd integer N and a character CH as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Boundary Condition(s):
3 <= N <= 49

Example Input/Output 1:
Input:
5 *

Output:
*---*
**--*
*-*-*
*--**
*---*

Click the link below to solve this program
http://www.skillrack.com/solve/9254

9) Integer Pyramid Pattern

The program must accept an integer N as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Boundary Condition(s):
2 <= N <= 50

Example Input/Output 1:
Input:
5

Output:
* * * * 1
* * * 1 2 3
* * 1 2 3 4 5
* 1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9

Click the link below to solve this program
http://www.skillrack.com/solve/9255

10) Integer Border Pattern

The program must accept an integer N as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Boundary Condition(s):
3 <= N <= 100

Example Input/Output 1:
Input:
5

Output:
1 2 3 4 5
6 * * * 7
8 * * * 9
10 * * * 11
12 13 14 15 16

Click the link below to solve this program
http://www.skillrack.com/solve/9252

View

Must Solve 100 Programs for Campus Placement Part - 9/10
6 days ago

1) First Two and Last Two

The program must accept a string S as the input. The program must print the first two characters in S and then print the last two characters in S as the output.

Boundary Condition(s):
4 <= Length of S <= 100

Example Input/Output 1:
Input:
programming

Output:
prng

Example Input/Output 2:
Input:
calculation

Output:
caon

Click the link below to solve this program
http://www.skillrack.com/solve/9214

2) Unit Digit - Ascending and Descending

The program must accept two integers as the input. The program must sort the two integers in ascending order based on their unit digit and print them as the output. If the unit digits are same then sort the two integers in descending order and print them as the output.

Example Input/Output 1:
Input:
57 102

Output:
102 57

Example Input/Output 2:
Input:
275 15

Output:
275 15

Click the link below to solve this program
http://www.skillrack.com/solve/9231

3) First Ten Multiples of X and Y

The program must accept two integers X and Y as the input. The program must print the first 10 multiples of X and Y as the output.

Example Input/Output 1:
Input:
3 7
 
Output:
3 6 7 9 12 14 15 18 21 24

Example Input/Output 2:
Input:
8 7

Output:
7 8 14 16 21 24 28 32 35 40

Click the link below to solve this program
http://www.skillrack.com/solve/9232

4) Reverse Even Integers

The program must accept N integers as the input. The program must print all the even integers among the N integers in reverse order as the output. If there is no even integer then the program must print -1 as the output.

Boundary Condition(s):
1 <= N <= 100
1 <= Each integer value <= 10^5

Example Input/Output 1:
Input:
5
1 2 5 7 8

Output:
8 2

Example Input/Output 2:
Input:
4
1 3 5 7

Output:
-1

Click the link below to solve this program
http://www.skillrack.com/solve/9233

5) Print Digits - X and Y

The program must accept two integers X and Y as the input. The program must print all the digits from the unit digit of X to the unit digit of Y as the output.

Example Input/Output 1:
Input:
512 69

Output:
2 3 4 5 6 7 8 9

Example Input/Output 2:
Input:
37 44

Output:
7 6 5 4

Click the link below to solve this program
http://www.skillrack.com/solve/9240

6) String without Space

The program must accept a string S with space as the input. The program must print the string without any space as the output.

Boundary Condition(s):
1 <= Length of S <= 100

Example Input/Output 1:
Input:
Hi this is skillrack

Output:
Hithisisskillrack

Example Input/Output 2:
Input:
Incredible India is my country

Output:
IncredibleIndiaismycountry

Click the link below to solve this program
http://www.skillrack.com/solve/9243

7) Count of S2 in S1

The program must accept two string values S1 and S2 as the input where the length of S2 is always 2. The program print the number of occurrences of the string S2 in S1 as the output.

Boundary Condition(s):
2 <= Length of S1 <= 100

Example Input/Output 1:
Input:
tomato
to

Output:
2

Example Input/Output 2:
Input:
AABBBCCBB
BB

Output:
3

Click the link below to solve this program
http://www.skillrack.com/solve/9241

8) Reverse Odd Digits

The program must accept an integer N as the input. The program must print all the odd digits of N in reverse order as the output. If there is no odd digit in N then the program must print -1 as the output.

Example Input/Output 1:
Input:
1047655

Output:
5571

Example Input/Output 2:
Input:
24820

Output:
-1

Click the link below to solve this program
http://www.skillrack.com/solve/9244

9) Inverse Fraction

The program must accept a fraction X/Y as the input. The program must invert the fraction and print the result with the precision up to two decimal places as the output.

Example Input/Output 1:
Input:
3/5

Output:
1.67

Explanation:
3/5 is inverted as 5/3. So the result is 1.67 (with the precision up to 2 decimal places)

Example Input/Output 2:
Input:
5/3

Output:
0.60

Click the link below to solve this program
http://www.skillrack.com/solve/9245

10) Sum - Unit Digit 3 or 6

The program must accept N integers as the input. The program must print the sum of integers having the unit digit as 3 or 6 as the output. If there is no such integer then the program must print -1 as the output.

Boundary Condition(s):
1 <= N <= 100
1 <= Each integer value <= 10^5

Example Input/Output 1:
Input:
5
12 43 30 606 7337

Output:
649

Example Input/Output 2:
Input:
4
52 84 365 134

Output:
-1

Click the link below to solve this program
http://www.skillrack.com/solve/9246

View

Must Solve 100 Programs for Campus Placement Part - 8/10
6 days ago

1) Sum - Last Three Digits

The program must accept an integer N as the input. The program must print the sum of the last three digits of N as the output.

Boundary Condition(s):
100 <= N <= 10^8

Example Input/Output 1:
Input:
2019

Output:
10

Example Input/Output 2:
Input:
1546

Output:
15

Click the link below to solve this program
http://www.skillrack.com/solve/9225

2) Predecessor and Successor of X

The program must accept N integers and an integer X as the input. The program must print the (X-1)th integer. Then the program must print the Xth integer. Then the program must print the (X+1)th integer.

Boundary Condition(s):
3 <= N <= 100
1 < X < N

Example Input/Output 1:
Input:
7
12 45 78 56 89 23 10
4

Output:
78 56 89

Click the link below to solve this program
http://www.skillrack.com/solve/9224

3) Find the Element

The program must accept N integers and an integer M as the input. The program must print yes if M is present in the N integers. Else the program must print no as the output.

Boundary Condition(s):
1 <= N <= 100
1 <= Each integer value, M <= 10^5

Example Input/Output 1:
Input:
6
91 73 64 82 50 33
73

Output:
yes

Click the link below to solve this program
http://www.skillrack.com/solve/9222

4) String Reversal

The program must accept a string S as the input. The program must reverse the string S and print it as the output.

Boundary condition(s):
2 <= Length of S <= 100

Example Input/Output 1:
Input:
skillrack

Output:
kcarlliks

Example Input/Output 2:
Input:
technology

Output:
ygolonhcet

Click the link below to solve this program
http://www.skillrack.com/solve/9221 

5) Consonants in First X Characters

The program must accept a string S and an integer X as the input. The program must print all the consonants in the first X characters of S as the output. If there is no consonant in the first X characters of S then the program must print -1 as the output.

Boundary Condition(s):
1 <= Length of S <= 100

Example Input/Output 1:
Input:
assurance
5

Output:
ssr

Example Input/Output 2:
Input:
aeiousky
4

Output:
-1

Click the link below to solve this program
http://www.skillrack.com/solve/9220 

6) Previous and Next - Alphabets

The program must accept a lower case alphabet CH as the input. The program must print the previous alphabet and the next alphabet of CH as the output.
Note:
For the alphabet a, consider the previous alphabet as z.
For the alphabet z, consider the next alphabet as a.

Example Input/Output 1:
Input:
c

Output:
bd

Example Input/Output 2:
Input:
z

Output:
ya

Click the link below to solve this program
http://www.skillrack.com/solve/9219 

7) Smallest and Largest - Sum

The program must accept three integers as the input. The program must print the sum of the smallest integer and the largest integer as the output.

Example Input/Output 1:
Input:
2 5 3

Output:
7

Example Input/Output 2:
Input:
0 1 3

Output:
3

Click the link below to solve this program
http://www.skillrack.com/solve/9218

8) Remove Special Characters

The program must accept a string S as the input. The program must remove all the special characters (other than the alphabets and digits) from the string S. Then the program must print the modified string S as the output.

Boundary Condition(s):
1 <= Length of S <= 100

Example Input/Output 1:
Input:
**skillrack#123***

Output:
skillrack123

Example Input/Output 2:
Input:
*ke@##123KEy

Output:
ke123KEy

Click the link below to solve this program
http://www.skillrack.com/solve/9217

9) Smallest to Largest Integer

Accept two integers X and Y as the input and print all the integers from the smallest integer to the largest integer as the output.

Example Input/Output 1:
Input:
10 5

Output:
5 6 7 8 9 10

Example Input/Output 2:
Input:
7 10

Output:
7 8 9 10

Click the link below to solve this program
http://www.skillrack.com/solve/9216

10) Print All Vowels

Accept a string S as the input and print all the vowels in S as the output. If there is no vowel in S then the program must print -1 as the output.

Boundary Condition(s):
1 <= Length of S <= 100

Example Input/Output 1:
Input:
SkillRack

Output:
ia

Example Input/Output 2:
Input:
Sky

Output:
-1

Click the link below to solve this program
http://www.skillrack.com/solve/9215

View

Must Solve 100 Programs for Campus Placement Part - 7/10
6 days ago

1) Characters - Position Times

The program must accept a string S of length 5 as the input. The program must print the first character once, the second character two times, the third character three times, the fourth character four times and the fifth character five times as the output.

Example Input/Output 1:
Input:
match

Output:
maatttcccchhhhh

Click the link below to solve this program
http://www.skillrack.com/solve/8106

2) Two Integer Triangle Pattern

The program must accept two integers N1 and N2 as the input. The program must print the desired pattern as shown in the Example Input/Output section.

Example Input/Output 1:
Input:
5 8

Output:
5 6 7 8
5 6 7
5 6
5

Example Input/Output 2:
Input:
1 5

Output:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Click the link below to solve this program
http://www.skillrack.com/solve/8110

3) First Three Factors

A non prime number N is passed as the input to the program. The program must print the first three factors of N as the output.

Example Input/Output 1:
Input:
9

Output:
1 3 9

Click the link below to solve this program
http://www.skillrack.com/solve/8103

4) Sort - Same Unit Digit

The program must accept three integers X, Y and Z as the input. Two of these three integers will have same unit digit. The program must print the smallest integer among the integers which are having the same unit digit. Then the program must print the largest integer among the integers which are having the same unit digit. Finally, the program must print the remaining integer as the output.

Example Input/Output 1:
Input:
72 29 12

Output:
12 72 29

Example Input/Output 2:
Input:
10 5 90

Output:
10 90 5

Click the link below to solve this program
http://www.skillrack.com/solve/8109

5) 12 to 24 Hour Time Format

The program must accept the time in 24-hour format. The program must print the time in 12-hour format as the output.

Example Input/Output 1:
Input:
0000

Output:
12:00 AM

Click the link below to solve this program
http://www.skillrack.com/solve/8108

6) Element in Xth Position

The program must accept N integers and an integer X as the input. The program must print the Xth integer as the output.

Boundary Condition(s):
1 <= N <= 100
1 <= X <= N

Example Input/Output 1:
Input:
5
10 52 63 74 90
3

Output:
63

Click the link below to solve this program
http://www.skillrack.com/solve/9230

7) Reverse N Integers

The program must accept N integers as the input. The program must print the N integers in reverse order as the output.

Example Input/Output 1:
Input:
6
10 22 30 14 51 60

Output:
60 51 14 30 22 10

Example Input/Output 2:
Input:
8
12 86 94 36 58 62 44 72

Output:
72 44 62 58 36 94 86 12

Click the link below to solve this program
http://www.skillrack.com/solve/9228

8) Print Two Digit Numbers

The program must accept N integers as the input. The program must print all the two digit integers among the N integers in reverse order as the output. If there is no two digit integer then the program must print -1 as the output.

Boundary Condition(s):
1 <= N <= 100
1 <= Each integer value <= 10^6

Example Input/Output 1:
Input:
6
10 987 75 1011 5 99

Output:
99 75 10

Example Input/Output 2:
8
203 540 897 1 6 501 150 2

Output:
-1

Click the link below to solve this program
http://www.skillrack.com/solve/9229

9) Product - Last Digit & First Digit

The program must accept two integers X and Y as the input. The program must print the product of the last digit of X and the first digit of Y as the output.

Example Input/Output 1:
Input:
514 2004

Output:
8

Example Input/Output 2:
Input:
56 375

Output:
18

Click the link below to solve this program
http://www.skillrack.com/solve/9227

10) 2 Power X

The program must accept an integer X as the input. The program must print the value of 2X (2 power X) as the output.

Example Input/Output 1:
Input:
4

Output:
16

Example Input/Output 2:
Input:
5

Output:
32

Click the link below to solve this program
http://www.skillrack.com/solve/9226

View

Must Solve 100 Programs for Campus Placement Part - 6/10
6 days ago

1) Double Five Times

The program must accept an integer N as the input. The program must double the value of N for 5 times and print it as the output.

Example Input/Output 1:
Input:
5

Output:
160

Example Input/Output 2:
Input:
3

Output:
96

Click the link below to solve this program
http://www.skillrack.com/solve/8100

2) Two Digit and Three Digit

The program must accept two integers N1 and N2 as the input. The program must print yes if N1 is a two digit number and N2 is a three digit number else print no as the output.

Example Input/Output 1:
Input:
17 324

Output:
yes

Example Input/Output 2:
Input:
7 521

Output:
no

Click the link below to solve this program
http://www.skillrack.com/solve/8105

3) Same or Different - Characters

The program must accept three characters ch1, ch2 and ch3 as the input. The program must print Same if the first two characters or the last two characters are same, else print Different as the output.
Note: Print Different, if all the characters are same.

Example Input/Output 1:
Input:
s g g

Output:
Same

Example Input/Output 2:
Input:
a a a

Output:
Different

Click the link below to solve this program
http://www.skillrack.com/solve/8091

4) Sorted or Not

Accept three integers A, B and C as the input. If A, B and C are in ascending order or in descending order then print "SORTED" as the output else print "NOTSORTED" as the output.

Example Input/Output 1:
Input:
1 4 9

Output:
SORTED

Example Input/Output 2:
Input:
35 23 23

Output:
SORTED

Click the link below to solve this program
http://www.skillrack.com/solve/8095

5) Match First Three Characters

The program must accept two string values S1 and S2 as the input. The program must print YES if the first three characters are equal in S1 and S2. Else the program must print NO as the output.

Boundary Condition(s):
3 <= Length of S1, S2 <= 100

Example Input/Output 1:
Input:
manager
manhole

Output:
YES

Example Input/Output 2:
Input:
Find
finale

Output:
NO

Click the link below to solve this program
http://www.skillrack.com/solve/8096

6) Five Integers - Odd Count

Five integers are passed as the input to the program. The program must print the count of odd integers as the output.

Example Input/Output 1:
Input:
2 7 14 13 29

Output:
3

Click the link below to solve this program
http://www.skillrack.com/solve/8104

7) Absolute Difference Multiples

The program must accept two integers N1 and N2 as the input. The program must print the first 10 multiples of their absolute difference (N1 and N2) as the output.

Example Input/Output 1:
Input:
5 8

Output:
3 6 9 12 15 18 21 24 27 30

Example Input/Output 2:
Input:
7 5

Output:
2 4 6 8 10 12 14 16 18 20

Click the link below to solve this program
http://www.skillrack.com/solve/8097

8) Five Alphabets

An alphabet CH from 'A' to 'V' is passed as the input to the program. The program must print five alphabets from CH as the output. Note: The characters can be represented as integers using ASCII values.

Example Input/Output 1:
Input:
E

Output:
EFGHI

Click the link below to solve this program
http://www.skillrack.com/solve/8102

9) Same Numerator or Denominator

The program must accept two fractions as the input. Then the program must print yes as the output if the numerators of two fractions are equal or the denominators of two fractions are equal. Else the program must print no as the output.

Example Input/Output 1:
Input:
1/2 3/2

Output:
yes

Click the link below to solve this program
http://www.skillrack.com/solve/8098

10) Positive or Negative Based Multiples

Accept an integer A as the input. If A is a positive integer then print the first five multiples of the unit digit of A as the output. If A is a negative integer then print the first ten multiples of the unit digit of A as the output.

Example Input/Output 1:
Input:
46

Output:
6 12 18 24 30

Example Input/Output 2:
Input:
-53

Output:
3 6 9 12 15 18 21 24 27 30

Click the link below to solve this program
http://www.skillrack.com/solve/8107

View

Must Solve 100 Programs for Campus Placement Part - 5/10
6 days ago

1) Length of the String

The program must accept a string S as the input. The program must print the length of S as the output.

Boundary Condition(s):
1 <= Length of S <= 1000

Example Input/Output 1:
Input:
hello

Output:
5

Example Input/Output 2:
Input:
pineapple

Output:
9

Click the link below to solve this program
http://www.skillrack.com/solve/7936

2) Middle Three Characters

A string S of length 7 is passed as the input to the program. The program must print the middle three characters as the output.

Example Input/Output:
Input:
brinjal

Output
inj

Click the link below to solve this program
http://www.skillrack.com/solve/8088

3) Print Last Four Digits

The program must accept an integer N as the input. The program must print the last four digits in N as the output.

Example Input/Output 1:
Input:
23847

Output:
3847

Example Input/Output 2:
Input:
23477234

Output:
7234

Click the link below to solve this program
http://www.skillrack.com/solve/8057

4) Discount - 20%

The program must accept the price of an item as the input. The program must print the price of the item after 20 percent discount with the precision up to two decimal places as the output.

Example Input/Output 1:
Input:
29

Output:
23.20

Click the link below to solve this program
http://www.skillrack.com/solve/8089

5) Odd Even Mixed

Accept two integers A and B as the input.
- If A and B are even then print "EVEN" as the output.
- If A and B are odd then print "ODD" as the output.
- If A is odd and B is even or if A is even and B is odd then print "MIXED" as the output.

Example Input/Output 1:
Input:
22 14

Output:
EVEN

Example Input/Output 2:
Input:
11 47

Output:
ODD

Example Input/Output 3:
Input:
34 97

Output:
MIXED

Click the link below to solve this program
http://www.skillrack.com/solve/8090

6) Sum of Two to Get Third Integer

The program must accept three integers as the input. The program must print yes if any two of the three integers can be added to obtain the remaining integer as the output. Else the program must print no as the output.

Example Input/Output 1:
Input:
-1 2 3

Output
yes

Explanation:
-1 + 3 = 2

Click the link below to solve this program
http://www.skillrack.com/solve/8092

7) N Integers From N

The program must accept an integer N as the input. Then the program must print N integers from N as the output.

Example Input/Output 1:
Input:
5

Output:
5 6 7 8 9

Click the link below to solve this program
http://www.skillrack.com/solve/8094

8) Calculate Park Entrance Fee

In a park, they charge X rupees for adults and Y rupees for kids for entry. The program must accept two integers A and B as the input(where A is the number of adults and B is the number of kids). The program must print the total amount charged as the output.

Example Input/Output 1:
Input:
100 50
2 3

Output:
350

Example Input/Output 2:
Input:
30 10
4 5

Output:
170

Click the link below to solve this program
http://www.skillrack.com/solve/8101

9) Multiple of 30 Plus 1 or 2

The program must accept an integer N as the intput. The program must print YES if N is exactly one or two more than a multiple of 30 as the output. Else the program must print NO as the output.

Example Input/Output 1:
Input:
31

Output:
YES

Example Input/Output 2:
Input:
63

Output:
NO

Click the link below to solve this program
http://www.skillrack.com/solve/8093

10) Check if Multiple of N1 and N2

The program must accept three integers N1, N2 and N3 as the input. The program must print yes if N2 is a multiple of N1 and N3 is a multiple of N2. Else the program must print no as the output.

Example Input/Output 1:
Input:
8 32 64

Output:
yes

Click the link below to solve this program
http://www.skillrack.com/solve/8099

View

Must Solve 100 Programs for Campus Placement Part - 4/10
6 days ago

1) Print - 1 to 222

The program must print from 1 to 222, with the numbers separated by a space.

Click the link below to solve this program
http://www.skillrack.com/solve/7897

2) Sum - Format Print

The program must print the sum of two numbers as per the format given in the Example Input/Output Section.

Example Input/Output 1:
Input:
5 20

Output:
5+20=25

Click the link below to solve this program
http://www.skillrack.com/solve/7899

3) Minutes to Seconds

The program must accept minutes and convert into seconds.

Note: 1 minute = 60 seconds

Example Input/Output 1:
Input:
5

Output:
300

Example Input/Output 2:
Input:
4

Output:
240

Click the link below to solve this program
http://www.skillrack.com/solve/7894

4) Century or Half-Century

The runs scored by a batsman is passed as the input. The program must print if he has scored a Century or Half-Century.

Note: If the runs is from 50 to 99, it is Half-Century. Else if the runs is 100 or above it is Century. Also the value of runs will be greater than or equal to 50.

Example Input/Output 1:
Input:
55

Output:
Half-Century

Example Input/Output 2:
Input:
50

Output:
Half-Century

Example Input/Output 3:
Input:
102

Output:
Century

Click the link below to solve this program
http://www.skillrack.com/solve/7890

5) Print - 111 to 2

The program must print from 111 to 2 with the values separated by a space.

Click the link below to solve this program
http://www.skillrack.com/solve/7900

6) One to Five - Words

The program must accept a number from 1 to 5 and print it as a word as given below.
1 - One
2 - Two
3 - Three
4 - Four
5 - Five

Example Input/Output 1:
Input:
3

Output:
Three

Example Input/Output 2:
Input:
1

Output:
One

Click the link below to solve this program
http://www.skillrack.com/solve/7896

7) Ten Multiples

The program must accept a number and print it's first ten multiples.

Example Input/Output 1:
Input:
3

Output:
3 6 9 12 15 18 21 24 27 30

Example Input/Output 2:
Input:
5

Output:
5 10 15 20 25 30 35 40 45 50

Click the link below to solve this program
http://www.skillrack.com/solve/7903

8) String - Print Twice

The program must accept a string value and print it twice.

Example Input/Output 1:
Input:
SkillRack

Output:
SkillRackSkillRack

Click the link below to solve this program
http://www.skillrack.com/solve/7895

9) Square - Format Print

The program must print a number and print the square as per the format given in the Example Input/Output Section.

Example Input/Output 1:
Input:
5

Output:
Square of 5 is 25

Example Input/Output 2:
Input:
10

Output:
Square of 10 is 100

Click the link below to solve this program
http://www.skillrack.com/solve/7898

10) 1 to 100 - Hyphen Separated

The program must print from 1 to 100 with the values separated by a hyphen.

Click the link below to solve this program
http://www.skillrack.com/solve/7901

View

Must Solve 100 Programs for Campus Placement Part - 3/10
6 days ago

1) Odd or Even

The program must print if the given number is Odd or Even.

Example Input/Output 1:
Input:
5

Output:
Odd

Example Input/Output 2:
Input:
102

Output:
Even

Click the link below to solve this program
http://www.skillrack.com/solve/7886

2) Mobile Signal

The program must accept a character representing the mobile signal.
- If the character is E, print 2G
- If the character is H, print 3G
- Else print 4G

Click the link below to solve this program
http://www.skillrack.com/solve/7885

3) Hot Cold or Normal

The program must print Hot if the given temperature value is more than 30, must print Cold if the given value is less than 22. Else the program must print Normal.

Example Input/Output 1:
Input:
25

Output:
Normal

Example Input/Output 2:
Input:
34

Output:
Hot

Example Input/Output 3:
Input:
18

Output:
Cold

Click the link below to solve this program
http://www.skillrack.com/solve/7887

4) Multiply Two Numbers

Accept two numbers and print their product.

Example Input/Output 1:
Input:
10 5

Output:
50

Example Input/Output 2:
Input:
6 5

Output:
30

Click the link below to solve this program
http://www.skillrack.com/solve/7904

5) Two Subjects - pass or fail

The pass mark in a subject is 40. The marks scored in two subjects by a student is passed as the input. If the student has passed in both the subjects, the program must print pass. Else must print fail.

Example Input/Output 1:
Input:
50 60

Output:
pass

Example Input/Output 2:
Input:
34 60

Output:
fail

Click the link below to solve this program
http://www.skillrack.com/solve/7888

6) Atleast One Number 100

The numbers are passed as the input to the program. If at least one of the numbers is equal to 100, the program must print yes. Else the program must print no.

Example Input/Output 1:
Input:
50 100

Output:
yes

Example Input/Output 2:
Input:
34 60

Output:
no

Click the link below to solve this program
http://www.skillrack.com/solve/7889

7) Not Equal to Zero

The program must accept a number and print yes if it is NOT equal to zero. Else it must print no.

Example Input/Output 1:
Input:
0

Output:
no

Example Input/Output 2:
Input:
22

Output:
yes

Click the link below to solve this program
http://www.skillrack.com/solve/7893

8) Division - Two Values

The program must accept two numbers and print the value (up to two decimal places) when they are divided.

Example Input/Output 1:
Input:
10 4

Output:
2.50

Example Input/Output 2:
Input:
20 3

Output:
6.67

Click the link below to solve this program
http://www.skillrack.com/solve/7891

9) Canteen Expense

A student has Rs.100 in hand. He buys snacks for X rupees from the canteen. The program must print the amount remaining with the student.

Note: The program must accept the value of X as the input.

Example Input/Output 1:
Input:
60

Output:
40

Example Input/Output 2:
Input:
75

Output:
25

Click the link below to solve this program
http://www.skillrack.com/solve/7902

10) Average - Two Numbers

The program must accept two numbers and print their average (up to two decimal places).

Example Input/Output 1:
Input:
10 4

Output:
7.00

Example Input/Output 2:
Input:
20 3

Output:
11.50

Click the link below to solve this program
http://www.skillrack.com/solve/7892

View

Must Solve 100 Programs for Campus Placement Part - 2/10
6 days ago

1) Two Numbers Equal

The program must accept two numbers and print yes if they are equal. Else the program must print no as the output.

Example Input/Output 1:
Input:
40 40

Output:
yes

Example Input/Output 2:
Input:
50 90

Output:
no

Click the link below to solve this program
http://www.skillrack.com/solve/7876

2) Largest of Two Numbers

The program must accept two numbers and print the largest number.

Example Input/Output 1:
Input:
12 25

Output:
25

Example Input/Output 2:
Input:
9 5

Output:
9

Click the link below to solve this program
http://www.skillrack.com/solve/7877

3) Print Remainder when Divided by 5

The program must accept a number and print its remainder when it is divided by 5.

Example Input/Output 1:
Input:
12

Output:
2

Example Input/Output 2:
Input:
10

Output:
0

Click the link below to solve this program
http://www.skillrack.com/solve/7878

4) Pass or Fail

The program must accept a mark and print if it is pass or fail. The pass mark is 40.

Example Input/Output 1:
Input:
40

Output:
pass

Example Input/Output 2:
Input:
32

Output:
fail

Click the link below to solve this program
http://www.skillrack.com/solve/7875

5) Multiply Two Numbers

Accept two numbers and print their product.

Example Input/Output 1:
Input:
4 5

Output:
20

Example Input/Output 2:
Input:
11 12

Output:
132

Click the link below to solve this program
http://www.skillrack.com/solve/7879

6) Multiply Three Numbers

Accept three numbers and print their product.

Example Input/Output 1:
Input:
2 5 10

Output:
100

Example Input/Output 2:
Input:
6 3 7

Output:
126

Click the link below to solve this program
http://www.skillrack.com/solve/7883

7) Print Unit Digit

The program must accept a number and print its unit digit.

Example Input/Output 1:
Input:
72

Output:
2

Example Input/Output 2:
Input:
65

Output:
5

Click the link below to solve this program
http://www.skillrack.com/solve/7881

8) Smallest of Two Numbers

The program must accept two numbers and print the smallest number.

Example Input/Output 1:
Input:
14 23

Output:
14

Example Input/Output 2:
Input:
5 1

Output:
1

Click the link below to solve this program
http://www.skillrack.com/solve/7882

9) Character - Male or Female

The program must accept a character.
- If the character is m, print male
- If the character is f, print female

Click the link below to solve this program
http://www.skillrack.com/solve/7884

10) Remove Unit Digit

The program must accept a number and remove the unit digit.

Note: The number is greater than 9.

Example Input/Output 1:
Input:
102

Output:
10

Example Input/Output 2:
Input:
12345

Output:
1234

Click the link below to solve this program
http://www.skillrack.com/solve/7880

View

Must Solve 100 Programs for Campus Placement Part - 1/10
6 days ago

1) Print SkillRack as the Output

The program must print SkillRack as the output.

Note: S and R are in upper case.

Click the link below to solve this program
http://www.skillrack.com/solve/7864

2) Print Skill Rack in first two lines

The program must print Skill in the first line and Rack in the second line.

Note: S and R are in upper case.

Output:
Skill
Rack

Click the link below to solve this program
http://www.skillrack.com/solve/7866

3) Add Two Numbers

Accept two numbers and print their sum.

Example Input/Output 1:
Input:
10 20

Output:
30

Example Input/Output 2:
Input:
137 11

Output:
148

Click the link below to solve this program
http://www.skillrack.com/solve/7867

4) Multiply by 2

The program must accept a number and multiply it by 2.

Example Input/Output 1:
Input:
10

Output:
20

Example Input/Output 2:
Input:
50

Output:
100

Click the link below to solve this program
http://www.skillrack.com/solve/7868

5) Subtract Two Numbers

The program must accept two numbers and subtract them.

Example Input/Output 1:
Input:
100 40

Output:
60

Example Input/Output 2:
Input:
50 200

Output:
-150

Click the link below to solve this program
http://www.skillrack.com/solve/7869

6) Print Square

The program must accept a number and print it's square.

Example Input/Output 1:
Input:
5

Output:
25

Example Input/Output 2:
Input:
9

Output:
81

Click the link below to solve this program
http://www.skillrack.com/solve/7870

7) Print the Previous Number

The program must accept a number and print its previous number.

Example Input/Output 1:
Input:
68

Output:
67

Example Input/Output 2:
Input:
100

Output:
99

Click the link below to solve this program
http://www.skillrack.com/solve/7871

8) Print the Next Number

The program must accept a number and print its next number.

Example Input/Output 1:
Input:
5

Output:
6

Example Input/Output 2:
Input:
99

Output:
100

Click the link below to solve this program
http://www.skillrack.com/solve/7872

9) Print Cube

The program must accept a number and print it's cube.

Example Input/Output 1:
Input:
5

Output:
125

Example Input/Output 2:
Input:
3

Output:
27

Click the link below to solve this program
http://www.skillrack.com/solve/7873

10) Add Three Numbers

Accept three numbers and print their sum.

Example Input/Output 1:
Input:
5 2 4

Output:
11

Example Input/Output 2:
Input:
25 15 10

Output:
50

Click the link below to solve this program
http://www.skillrack.com/solve/7874

View

How to print the ASCII value of a character?
7 days ago

ASCII abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices.

The below C program accepts a character and prints the ASCII value of the same character as the output.

#include <stdio.h>
#include <stdlib.h>

int main()
{
    char ch;
    scanf("%c", &ch);
    printf("%d", ch);
    return 0;
}

The below Java program accepts a character and prints the ASCII value of the same character as the output.

import java.util.*;

public class Hello {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char ch = scanner.next().charAt(0);
        System.out.println((int) ch);
    }
}

The below Python program accepts a character and prints the ASCII value of the same character as the output.

char = input()
print(ord(char))

 

View

Find the square root of an integer without using any in-built function
4 months ago

How to find the square root of an integer without using any in-built function?

Using Newton Raphson method we can find the square root of an integer without using any in-built function.

The C solution is given below.

#include<stdio.h>
//Newton Raphson method to find square root without using in built function

double absolute(double val){
  return val < 0 ? -val:val;    
}

double findSquareRoot(int N){
    const double diff = 0.00001;
    double sqRoot = 1.0;
    while( absolute(N - (sqRoot*sqRoot)) >= diff){
        sqRoot = (N/sqRoot + sqRoot)/2.0;        
    }
    return sqRoot;    
}


int main()
{
    int N;
    scanf("%d",&N);
    printf("\n%.5lf",findSquareRoot(N));
    return 0;
}

 

View