Sunday, 12 November 2017

Code Challenge Solutions

  1. Seat Belt Problem


Dr. Dexter's car's seat belt detectors have been corrupted. So he wants you to build a module which checks if all the seat belts are worn. If and only if all the seat belts are worn Xinyou must start driving
Write a C program module that checks if all the seat belts have been worn.


Input and Output Format:

Input consists of n+1 lines.

The first line of input is an integer 'n' corresponding to the number of seats. 0 < n < 32767

The next n lines consist of strings 'yes' or 'no' corresponding to whether the seat belts have been worn or not.

Output consists of a single string 'Yes I can drive', 'No I can't drive' or 'Invalid Input'

Assume that all inputs consist of lowercase characters only.

All text in bold corresponds to input and the rest to output


Sample Input1:
2
no
no
Sample Output 1:
No I can't drive


Sample Input 2:
3
yes
yes
yes
Sample Output 2:
Yes I can drive

Sample Input 3:
3
No
Yes
Yes
Sample Output 3:
Invalid Input


Program

#include<stdio.h>
#include<string.h>
int main()
{
char a[100];
int n,i,count=0;
scanf("%d",&n);
if( n>0  )
{
for(   i=0;i<n;i++   )
{
scanf("%s",a);
if(strcmp(a,"yes") == 0)
{
count++;
}
else if( strcmp(a,"No") == 0 || strcmp(a,"Yes") == 0)
{
printf("\nInvalid Input");
return 0;
}
}
if(   count == n     )
printf("Yes I can drive");
else
printf("No I can't drive");
}
else
printf("Invalid Input");
return 0;
}


2.Petrol Variety Problem


Dr. Dexter is now in the gas bunk.

 He has perfectly planned his trip. 
He has been working keenly on the budget so that the trip goes on well.
 Now, he finds that there are two varieties of fuel – Ordinary and Speed.
 Speed fuel yields him a fairly better performance than its ordinary counterpart. 
He wants Xinyou to find out as to which variety of fuel he must opt for to stick to the budget.
Write a C program to find out the variety of fuel.
Input and Output Format:
Input consists of 5 lines.
The first line of input is a floating point number 'm' corresponding to the mileage Dr.Dexter's car yields.
The second line and third lines of input consists of floating point numbers 'o' and 's'
 corresponding to the costs of ordinary fuel and speed fuel respectively.
The fourth line of input is an integer 'd' corresponding to the distance between the bunk and Shinyao.
The fifth line of input is a floating point number 'b' corresponding to the budget for the fuel.
Output consists of a string 'Ordinary' or 'Speed'.
Sample Input 1: 
25 = m
75 = o
100 = s
3 = d
500 = b
Sample Output 1:
Speed
Sample Input 2: 
25
75
100
25
80
Sample Output 2:
Ordinary

Program

#include<stdio.h> 
int main() 
int m,o,s,d,b,i=0; 
scanf("%d%d%d%d%d",&m,&o,&s,&d,&b); 
if(d <= m) 
i++; 
else 
{while( d>m) 
d-=m; 
i++; 
if(b>=(i*s)) 
printf("\nSpeed"); 
else 
if(  b < (i*s)) 
printf("\nOrdinary"); 
}return 0; 

Saturday, 11 November 2017

Exploring Idukki, Kerala

                            Idukki is famous for its greenery and water bodies. Idukki is one among such places where there is not just one peak. instead, there are a lot of peaks to explore. So we decided to have a ride in its wilderness. We went on our bikes, It was our nearest district as we were staying in Kollam, it took us few hours to reach the place where we were staying. We stayed at Idukki for two days and captured some mind-blowing views.


At the time we reached Idukki, it was already dark.



















It was cold and visibility was bad. But it was really fun.
First place to visit on next day was, Ramakkalmedu
Ramakkalmedu was very windy and also gave an excellent view of Tamil Nadu.
Way to our next stop, Panchalimedu


According to the myths, The Pandavas along with their spouse 'Panchali'had a sojourn there at the time of one-year exile. Hence the place got its name Panchalimedu which derived from the words "Panchali" (Draupadi) and "medu" (hill). The local tribes there offered selfless help to the princes. Pandavas left the region before the beginning of one year incognito. 


An ancient Shiva-linga found at the top.  #Shiva-Lingam of Panchalimedu
This place is hidden with green from all sides.

Day 2: On my way to Kalyanathandu/Calvary Mount
Lots of Tea plantations on roadsides. 

Calvary Mount was a visual treat. 
It was heaven on earth. 

























Tried to click as many as possible before leaving.  :(



Instrument CLusters of Popular Indian Automobiles

                          If you ask me, 'What do I like most in an airplane?', undoubtedly I would say it is its Cockpit. Cockpits are an amusement for many. Anyone would wish to have a seat in it. But, it is a bitter truth that a common man cannot afford to have it. So, for people like us 'The major middle class of India', we look up to Cars & Bikes. We look how elegant is its interior, and how cool is its Instrument Cluster.
                  As we know Instrument cluster of a vehicle will be the front face of his/her vehicle from the drivers perspective. So it is very essential that the driver should be passionate about it. I am one among the many people out there who first checks out the instrument cluster of any new vehicle. Don't know why, but we are so interested in it. So for them, here are some of the instrument cluster photos of some automobiles which I was able to get my hands on. Scroll down through my collection and comment your favorite one. Hope this entertains you :)


Ford Figo - A widely accepted hatch in the Indian market. Sporty Red Analogue Cluster.






The Hyundai i10. 
Maruti Suzuki Baleno - Blue is Awesome.
Volkswagen Polo - TSI Highline

Bajaj Pulsar 200NS



Honda CB Trigger

Renault Duster




















Friday, 10 November 2017

Road Trip to 'Yercaud', Tamil Nadu

The journey began with such a pleasant view of the Open Roads ahead.
Lots of Hills on either sides.
Beautiful Clear Skies


On the way to the peak point
Tons of Turns xD

At the peak. #Yercaud <3
Awesome Background. Wallpaper Materials :)
Boating time in Yercaud Lake
It was adventurous 
Hates that sound though!! :D

Way Back!! :(


                                          We started our journey from bangalore and returned after staying for a day at Yercaud. It was a great weekend trip that we enjoyed a lot. Yercaud is a beautiful place covered with mountains. And our journey was a cool as the destination. If you are also planing to for a day trip from bangalore, I would suggest you not to remove Yercaud from your list. :)