Search This Blog

Saturday 29 June 2019

Skill Rack Daily Challenge Solution Date - 29/06/2019

Skill Rack
Daily Challenge Solution
Date : 29/06/2019

ProgramID- 7656

Right Triangle with Asterisk 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):
1 <= N <= 1000
Input Format:
The first line contains the integer N.
Output Format:
The first N lines contain the desired pattern as shown in the Example Input/Output section.
Example Input/Output 1:
Input:
4
Output:
1
2*3
4*5*6
7*8*9*10
Example Input/Output 2:
Input:
7
Output:
1
2*3
4*5*6
7*8*9*10
11*12*13*14*15
16*17*18*19*20*21
22*23*24*25*26*27*28

Max Execution Time Limit: 2000 millisecs


Solution :
______________________________________________________

#include <stdio.h>

int main()
{
    int num,count=1;
    scanf("%d",&num);
    for(int i=0;i<num;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(j!=0)printf("*");
            printf("%d",count++);
        }
        printf("\n");
    }
    return 0;
}
______________________________________________________

Tuesday 21 May 2019

Skill Rack Daily Challenge Solution Date - 22/05/2019

Skill Rack
Daily Challenge Solution
Date : 22/05/2019


ProgramID- 8668

Check All Vowels Present

The program must accept a string S. The program must print yes if all the vowels are present in S as the output. Else the program must print no as the output.
Note: All the alphabets in S are in lowercase.
Boundary Condition(s):
2 <= Length of S <= 100
Input Format:
The first line contains S.
Output Format:
The first line contains yes or no.
Example Input/Output 1:
Input:
tramiorue
Output:
yes
Explanation:
All the five vowels (aeiou) are present in tramiorue.
Hence yes is printed.
Example Input/Output 2:
Input:
rectangle
Output:
no

Solution :
__________________________________________________________________
**Don't copy this same , While copying please change the variables , Otherwise you will be suffer ** __________________________________________________________________
#include<stdio.h>
#include <stdlib.h>

int main()
{
    char s[100],vowels[5]={'a','e','i','o','u'};
    int count=0;
    scanf("%s",s);
    for(int i=0;i<5;i++)
    {
        int present=0;
        for(int j=0;s[j]!=NULL;j++)
        {
            if(s[j]==vowels[i])
            {
                present=1;
            }
        }
        if(present==0)
        count++;
    }
    if(count==5)
    {
        printf("yes");
    }
    else
    {
        printf("no");
    }
}
__________________________________________________________________
**Don't copy this same , While copying please change the variables , Otherwise you will be suffer ** __________________________________________________________________

Saturday 18 May 2019

Skill Rack Daily Challenge Solution Date : 18/05/2019

Skill Rack
Daily Challenge Solution
Date : 18/05/2019


ProgramID- 8637

Characters - Factors of Length

The program must accept a string S as the input. The program must calculate the length of string S as L. Then the program must print the characters which are present at the positions of the factors of L in ascending order as the output.
Boundary Condition(s):
1 <= Length of S <= 100
Input Format:
The first line contains the string S.
Output Format:
The first line contains the characters based on the above conditions.
Example Input/Output 1:
Input:
skillrack
Output:
sik
Explanation:
The length of the string "skillrack" is 9.
The factors of 9 are 1, 3 and 9.
So the characters present at the positions 1, 3 and 9 are printed.
Hence the output is sik
Example Input/Output 2:
Input:
google
Output:
gooe
Solution:
__________________________________________________________________
**Don't copy this same , While copying please change the variables , Otherwise you will be suffer ** __________________________________________________________________

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

int main()
{
    char s[100];
    int length;
    scanf("%s",s);
    length=strlen(s);
    for(int i=1;i<=length;i++)
    {
        if(length%i==0)
        {
            printf("%c",s[i-1]);
        }
    }
    return 0;
}

__________________________________________________________________
**Don't copy this same , While copying please change the variables , Otherwise you will be suffer ** 

Thursday 16 May 2019

Skill Rack Daily MCQ Answer and Solution Date - 16/05/2019

Skill Rack
Daily MCQ Answer and Solution
Date : 16/05/2019


REFID: 33883

R started a business with Rs.28000 and is joined later by V with Rs.48000. After how many months did V join if the profits at the end of the year were divided equally?

Answer : 5 months

Solution:

Suppose V joined after x months
then,
28000*12=48000*(12-x)
=>x=5
answer is 5 months

Skill Rack Daily Challenge Solution Date - 16/05/2019

Skill Rack
Daily Challenge Solution
Date : 16/05/2019


ProgramID- 8629

Zig-Zag from Top Right

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):
1 <= N <= 50
Input Format:
The first line contains the value of N.
Output Format:
The first N lines containing the desired pattern as shown in the Example Input/Output section.
Example Input/Output 1:
Input:
4
Output:
4 3 2 1
5 6 7 8
12 11 10 9
13 14 15 16
Example Input/Output 2:
Input:
3
Output:
3 2 1
4 5 6
9 8 7

Solution:
_____________________________________________________

**Don't copy this same , While copying please change the variables , Otherwise you will be suffer **
_____________________________________________________


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

int main()
{
    int n,i,j,number=1,matrix[50][50];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        if(i==0||i%2==0)
        {
            for(j=n-1;j>=0;j--)
            {
                matrix[i][j]=number;
                number++;
            }
        }
        else
        {
            for(j=0;j<n;j++)
            {
                matrix[i][j]=number;
                number++;
            }
        }
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            printf("%d ",matrix[i][j]);
        }
        printf("\n");
    }
    return 0;
}
_____________________________________________________
**Don't copy this same , While copying please change the variables , Otherwise you will be suffer **

Tuesday 14 May 2019

Skill Rack Daily MCQ Answer and Solution Date - 14/05/2019

Skill Rack
Daily MCQ Answer and Solution
Date : 14/05/2019


REFID: 33886

The number which when multiplied by 23 increases by 1936, is

 Answer : 88

Solution :


Let the number be x
So acc to ques

23x = x+1936
22x = 1936
X = 1936 / 22

X = 88
answer is 88

Skill Rack Daily Challenge Solution Date - 14/05/2019

Skill Rack
Daily Challenge Solution
Date : 14/05/2019



ProgramID- 7680
Check Repeated Alphabets

The program must accept a string value S as the input. The program must print invalid if the alphabets are repeated continuously for more than two times. Else the program must print valid as the output.
Boundary Condition(s):
3 <= Length of S <= 100
Input Format:
The first line contains the values of string S.
Output Format:
The first line contains either invalid or valid.
Example Input/Output 1:
Input:
dreaaam
Output:
invalid
Explanation:
In dreaaam, a is repeated more than two times continuously.
Hence the output is invalid
Example Input/Output 2:
Input:
skillrack
Output:
valid
Solution :
________________________________________________________

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

int main()
{
    char s[100];
    int i,repeat=0;
    scanf("%s",s);
    for(i=0;s[i]!=NULL;i++)
    {
        if(s[i]==s[i+1]&&s[i]==s[i+2])
        {
            repeat++;
        }
    }
    if(repeat==0)
    {
        printf("valid");
    }
    else
    {
        printf("invalid");
    }
       
}
________________________________________________________  
**Don't copy this same , While copying please change the variables , Otherwise you will be suffer **

Tuesday 7 May 2019

Skill Rack Daily MCQ Answer and Solution Date - 08/05/2019

Skill Rack
Daily MCQ Answer and Solution
Date : 08/05/2019

REFID: 40091

The average of 5 numbers is 65. The average of the first two numbers is 81 and the average of the last two numbers is 38. What is the third number?

Answer : 87

Solution :

the total for 5 numbers = 65x5=325
total for first two numbers=81x2=162
total for last two numbers=38x2=76
hence third number = 325-(162+76)=87

Monday 6 May 2019

Skill Rack Daily MCQ Answer & Solution Date - 06/05/2019

Skill Rack
Daily MCQ Answer & Solution
Date : 06/05/2019


REFID: 40426

If the perimeter of a square is equal to the radius of a circle whose area is 39424 sq cm, what is the area of the square?

Answer : 784 sq cm

Solution :

Let radius of circle be R cm.
Area of circle = 39424

Ï€R² = 39424

R² × 22/7 = 39424 

R² = ( 39424 × 7 /22 )

R² = 12544

R = √12544

R = 112 cm.

Radius of circle ( R ) = 112 cm.


Given that : Perimeter of square is equal to the Radius of circle whose area is 39424 cm².


Therefore,


Perimeter of circle = 112 cm.

4 × Side = 112

Side = 28 cm 

Area of square = (Side)²

=> (28)² cm²

=> 784 cm².
Answer is 784 sq cm.


Wednesday 1 May 2019

Skill Rack Daily Challenge Solution Date - 01/05/2019

Skill Rack

Daily Challenge Solution

Date : 01/05/2019


ProgramID- 8539

Distance Travelled + or -

The program must accept a string S representing the direction of movement as the input. The string S contains only the characters + and -. A boy moves 1 unit left side if the character in S is -. The boy moves 1 unit right side if the character in S is +. The program must print the distance between the starting position of the boy and the final position at the end of the string as the output.
Boundary Condition(s):
1 <= Length of S <= 1000
Input Format:
The first line contains the string S.
Output Format:
The first line contains the distance between the starting and final position of the boy.
Example Input/Output 1:
Input:
-+++-
Output:
1
Explanation:
The first character is - so he moves 1 unit towards his left.
The second character is + so he moves 1 unit towards his right so he reaches the starting position again.
The third character is + so he moves 1 unit towards his right. Now he is 1 unit away from the starting position.
The fourth character is + so he moves 1 unit towards his right. Now he is 2 units away from the starting position.
The fifth character is - so he moves 1 unit towards his left. Now he is 1 unit away from the starting position.
So the output is 1.
Example Input/Output 2:
Input:
+++++-
Output:
4

Solution:
__________________________________________________________

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

int main()
{
    char s[1000];
    int position=0;
    scanf("%s",s);
    for(int i=0;s[i]!=NULL;i++)
    {
        if(s[i]=='+') position++;
        else position--;
    }
    printf("%d",abs(position));
}
__________________________________________________________

Thursday 25 April 2019

Skill Rack Daily MCQ Answer and Solution Date - 26/04/2019

Skill Rack
Daily MCQ Answer and Solution
Date : 26/04/2019


REFID: 40459

A number when subtracted by 1/7 of itself gives the same value as the sum of all the angles of a triangle. What is the number?

Answer : 210 

Solution :

sum of angles in a triangle are 180 deg According to given data

Sum of Triangle : 180.
1/7 th of 210 is : 30
hence 210 - 30 =180
so the answer is 210.

Skill rack Daily Challenge Solution Date - 26/04/2019

 Skill rack
Daily Challenge Solution
Date : 26/04/2019



ProgramID- 6447
Variable Discount

The program must accept an integer P which represents the price of an item in a supermarket as the input. The program must print the discount amount for P up to 2 decimal places based on the following conditions,
- If the price is less than or equal to Rs. 1000 then 10 percentage discount is applied.
- Else if the price is greater than Rs. 1000 then 10 percentage discount is applied up to Rs. 1000 and 5 percentage discount is applied for the remaining price amount.

Boundary Condition(s):
1 <= P <= 99999999

Input Format:
The first line contains the value of P.

Output Format:
The first line contains the discount price up to 2 decimal places.

Example Input/Output 1:
Input:
852
Output:
85.20

Example Input/Output 2:
Input:
1543
Output:
127.15

Solution :
----------------------------------------------------------------------

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

int main()
{
    double price;
    scanf("%lf",&price);
    if(price<=1000)
    {
        price=0.10*price;
    }
    else
    {
        price=(0.05*(price-1000))+100;
    }
    printf("%.2lf",price);
}

---------------------------------------------------------------------- 

Saturday 20 April 2019

Skill Rack Daily MCQ Answer & Solution Date - 21/04/2019

Skill Rack

Daily MCQ Answer & Solution

Date : 21/04/2019

REFID: 40454

1/4 of 3/5 of 6/5 of a number = 54. What is the number?

Answer : 300

Solution :
Let`s consider a  number as `X’
6/5 of X is 6X/5
3/5 of 6X/5 is (3/5)x(6X/5)=18X/25
1/4 of 18X/25 is (1/4)x(18X/25)=18X/100
 so,
According to the question 18X/100=54
And hence X=300

Skill Rack Daily Challenge Solution Date - 21/04/2019

Skill Rack

Daily Challenge Solution

Date : 21/04/2019


ProgramID- 8007

Same Adjacent - Asterisks

The program must accept a string S as the input. The program must print YES if the adjacent characters of each asterisk (*) are same. Else the program must print NO as the output.
Note: The string does not contain any continuous asterisks.
Boundary Condition(s):
1 <= Length of S <= 100
Input Format:
The first line contains the string S.
Output Format:
The first line contains either YES or NO
Example Input/Output 1:
Input:
ab*bkt*tz
Output:
YES
Explanation:
The adjacent characters of the first * are b and b. Here the adjacent characters are same.
The adjacent characters of the second * are t and t. Here the adjacent characters are same.
Hence the output is YES
Example Input/Output 2:
Input:
cp*pl*l*h
Output:
NO

Solution :
--------------------------------------------------------------------


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

int main()
{
    char s[100];
    int same=0,star=0;
    scanf("%s",s);
    for(int i=0;s[i]!=NULL;i++)
    {
        if(s[i]=='*')
        {
            if(s[i-1]!=NULL&&s[i+1]!=NULL)
            {
                if(s[i-1]==s[i+1])
                {
                    same++;
                }
                star++;
            }
        }
    }
    if(same==star)printf("YES");
    else printf("NO");
    return 0;
   
}
--------------------------------------------------------------------
**Don't copy this same , While copying please change the variables , Otherwise you will be suffer **

Friday 19 April 2019

Skill Rack Daily MCQ Answer & Solution Date - 20/04/2019

Skill Rack

Daily MCQ Answer & Solution

Date : 20/04/2019

REFID: 40451

A bus started its journey from Ramgarh and reached Devgarh in 44 minutes at an average speed of 50 km/h. If the average speed of the bus is increased by 5 km/h, how much time will it take to cover the same distance?

Answer : 40 mins

Solution:


Description for Correct answer:
Distance between Ramgarh and Devgarh = 50×4460 = 1103 km

New speed = 55 kmph

= 5560 km / minute

Required time =  Distance Speed

= 1103×6055 = 40 minutes

Skill Rack Daily Challenge Solution Date - 20/04/2019

Skill Rack

Daily Challenge Solution

Date : 20/04/2019



ProgramID- 8515

Area of N Objects

The program must accept the shape and dimensions of N objects as the input. The program must print the sum of the area of all the objects as the output. The shape can be square or rectangle.
Boundary Condition(s):
1 <= N <= 1000
Input Format:
The first line contains N.
The next N lines contain the shape followed by dimension(s) side for square and length and breadth for rectangle separated by a space.
Output Format:
The first line contains the sum of the area of all the objects.
Example Input/Output 1:
Input:
4
square 5
rectangle 4 2
rectangle 3 10
square 11
Output:
184
Explanation:
The first object is square it's area is 5*5 = 25. The total area is 25.
The second object is rectangle it's area is 4*2 = 8. The total area is 33.
The third object is rectangle it's area is 3*10 = 30. The total area is 63.
The fourth object is square it's area is 11*11 = 121. The total area is 184.
Example Input/Output 2:
Input:
6
square 25
rectangle 17 24
square 5
rectangle 40 12
square 34
square 48
Output:
4998

Solution :
----------------------------------------------------------------------------------------
#include<stdio.h>
#include <stdlib.h>

int main()
{
    int n,ans,total=0;
    char s[20];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%s",s);
        if(s[0]=='s')
        {
            int a;
            scanf("%d",&a);
            ans=a*a;
        }
        else
        {
            int a,b;
            scanf("%d %d",&a,&b);
            ans=a*b;
        }
        total=total+ans;
    }
    printf("%d",total);
}
----------------------------------------------------------------------------------------

Thursday 11 April 2019

Skill Rack Daily MCQ Answer & Solution - 12/04/2019

Skill Rack

Daily MCQ Answer & Solution

Date : 12/04/2019

REFID: 41304

Instead of multiplying a number by 14, a student multiplied it by 6 and got an answer which differs by 384. What is the value of the number? 

Answer : 48

Solution :
14x-6x=384
8x=384
x=384/8
x=48
answer is 48

Monday 8 April 2019

Skill Rack Daily MCQ Answer and Solution - 08/04/2019

Skill Rack

Daily MCQ Answer & Solution

Date : 08/04/2019

REFID: 40447

What amount would a man receive on a principal of Rs. 4000 after two years on simple interest at the rate of 5 percent per annum?

Answer : 4410

Solution :
principal = 4000
5% per annum
4200 per annum
for 2 year 4410
answer is 4410 

Skill Rack Daily Challenge Solution - 08/04/2019

 Skill Rack

Daily Challenge Solution

Date : 08/04/2019



ProgramID- 8467
Replace Vowels - Circular Fashion

The program must accept a string S as the input. The program must replace all the vowels in S by the vowels a, e, i, o and u in a circular manner. Finally, the program must print the modified string as the output.
Note: All the alphabets in S are only in lower case.

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

Input Format:
The first line contains the string value S.

Output Format:
The first line contains the modified string value of S.

Example Input/Output 1:
Input:
kingkong

Output:
kangkeng

Explanation:
The vowels in the string kingkong are i and o. So they are replaced by a and e.
Hence the output is kangkeng

Example Input/Output 2:
Input:

icecreamchocolate

Output:
acecriomchucaleti
Solution :
-------------------------------------------------------------------------------------
#include<stdio.h>
#include <stdlib.h>

int main()
{
    char s[100],a[5]={'a','e','i','o','u'};
    int j=0,i;
    scanf("%s",s);
    for(i=0;s[i]!=NULL;i++)
    {
        if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')
        {
            s[i]=a[j];
            j++;
        }
        if(j>5)
        {
            j=0;
        }
    }
    printf("%s",s);
    return 0;

}
------------------------------------------------------------------------------------- 

Saturday 6 April 2019

Skill Rack Daily MCQ Answer & Solution - 07/04/2019

Skill Rack
Daily MCQ Answer & Solution
Date : 07/04/2019

REFID: 40444
Aman's expense is 30% more than Vimal's and Vimal's expense is 10% less than Raman's. If the sum of their expenses is Rs. 6447, then what would be Aman's expense?

Answer : 2457

Solution:
Aman Expenses = 30 % > Vimal Expense
Vimal Expense = 10 % < Raman Expense
Total Sum of their expense Aman + Vimal + Raman = Rs 6447
LET us assume vimal expense treat as X  
AMAN expense = Rs 130 and raman expense = Rs 
Proportion of expense of aman, vimal and raman respectively = 130; 100; 
= Rs 2457


Skill Rack Daily Challenge Solution - 07/04/2019

Skill Rack

Daily Challenge Solution

Date : 07/04/2019 



ProgramID- 8465

Product - Swap Unit Digits

The program must accept two integers X and Y as the input. The program must print the product of X and Y after swapping their unit digits as the output.
Boundary Condition(s):
1 <= X, Y <= 10^9
Input Format:
The first line contains the value of X and Y separated by a space.
Output Format:
The first line contains the product of X and Y after swapping their unit digits.
Example Input/Output 1:
Input:
984 51
Output:
52974
Explanation:
After swapping the unit digits of 984 and 51, their values become 981 and 54.
So the product of 981 and 54 is 52974.
Hence the output is 52974
Example Input/Output 2:
Input:
3988477 48754884
Output:
194457599172438

Solution :
---------------------------------------------------------------------------------------------

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

int main()
{
    long long int x,y,a,b,ans;
    scanf("%lld %lld",&x,&y);
    a=x%10;
    x=(x/10)*10;
    b=y%10;
    y=(y/10)*10;
    ans=(x+b)*(y+a)
    printf("%lld",ans);
    return 0;
}
---------------------------------------------------------------------------------------------

Skill Rack Daily MCQ Answer and Solution - 06/04/2019

Skill Rack

Daily MCQ Answer and Solution

Date : 06/04/2019


REFID: 40437

Choose the option to replace the question mark using approximation.
23.999 x 9.004 x 16.997 = ?

Answer : 3700

Solution:
23.999 * 9.004 * 16.997 = 3672.83067101

3672.83067101 ~ 3700
the answer is 3700

Skill Rack Daily Challenge Solution - 06/04/2019

Skill Rack

Daily Challenge Solution

Date : 06/04/2019



ProgramID- 8468

Sum of Dice Values

Pairs of integers are passed as the input to the program. The integers in each pair represent values of two dice in a game. If both the values are same, then the dice are rolled again. If the values are different, then the game ends. The program must print the sum of total number of values obtained from the dice at the end of the game.
Boundary Condition(s):
1 <= Value of each integer <= 6
Input Format:
The lines contain two integers each separated by a space.
Output Format:
The first line contains the sum of all values obtained from the dice.
Example Input/Output 1:
Input:
4 4
3 3
2 5
Output:
21
Explanation:
The dice are rolled until two different values are obtained.
So the total sum is 4 + 4 + 3 + 3 + 2 + 5 = 21
Example Input/Output 2:
Input:
5 5
1 1
2 2
4 4
5 4
Output:
33

Solution : 
--------------------------------------------------------------------

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

int main()
{
    int d1,d2,i,sum=0;
    for(i=0;;i++)
    {
        scanf("%d %d",&d1,&d2);
        sum=sum+(d1+d2);
        if(d1!=d2)break;
    }
    printf("%d",sum);
return 0;
}
--------------------------------------------------------------------