A (not-so-simple) C program.

The excitement level is so up that i couldn’t stop myself from writing this post.
Well , may not be a very big deal for everyone but it sure is a big thing to me. Yes , right now i feel like i am on cloud 9 πŸ™‚
Few days back , in one of our labs , we were supposed to write a C program and the question given was quite complicated for one to first understand.. It took me almost two hours,Β  sitting and thinking on what should i do..
I knew every logic that the question had.. but i had to struggle enough to write the code.

I will mention the question along with an example so that it is clear πŸ™‚

The question “just” said to round an “integer” not any specific but can be rounded upto any roundup digit ( which means , we take the roundup digit ). Simple isn’t it ? πŸ˜€
Well , it should include all the rounding off rules :
1. If it is to be rounded till m places , we note the ‘n’th’ digit , and check the ‘n+1’th’ digit
a. if the n+1’th digit is greater than 5, the n’th digit increases by 1
b. if the n+1’th digit is less than 5, the n’th digit remains the same.
2. IfΒ  it is to be rounded till m place, we note the note ‘n’th’ digit AND if the ‘n+1’th’ digit is 5
a. then the n’th digit , if even, then remains the same.
b. then the n’th digit , if odd , increase the n’th digit by 1.

Example –
1 . if the number is – 23476 : should be rounded to m= 4 places : so, n= 7 and n+1= 6
then the output should be – 2348
2. if the number is – 23474 : should be rounded to m= 4 places : so, n= 7 and n+1= 4
then the output should be – 2347
3. if the number is – 23465 : should be rounded to m = 4 places : so, n= 7 and n+1= 5
then the output should be – 2346
4. if the number is – 23475 : should be rounded to m = 4 places : so, n= 6 and n+1= 5
then the output should be – 2348

Lots of logic. Unluckily, none of the students could do it 😦 including me πŸ˜› many students tried google , but even google failed to answer them.
I felt bad, not because i couldn’t write the code in the class but because inspite of knowing the entire logic i couldn’t frame the code.
The day ended, i came back to the room and just bumped on the bed.. Stretched my legs , glued my eyes to the screen , took a pen and paper and started writing whatever i had in mind. My code was a little messy , it gave errors at few points. Finally , i asked for help from sayan da , and may be i couldn’t properly explain the question to him.

The only thing that i missed doing was:

y=num;
while(y!=0)
{
nobit++;
y=y/10;
}

and the rest everything was perfect. I was okay with the my code πŸ™‚ thanks to kartick for making me help with this little thing.
Here is the code:

#include<stdio.h>
main()
{
int num, abc, bit, bit1, i, y, nobit=0, div=1, round;
printf(“please enter a number: “);
scanf(“%d”, &num);//enter number
y=num;
while(y!=0)
{
nobit++;
y=y/10;
}
printf(“Please enter the the roundup digit: “);
scanf(“%d”, &round);//enter rounding digit
for(i=nobit; i>ask;i–)
div*=10;
abc=num/div;
bit=abc%10;
bit1=(num/(div/10))%10
/*Β Β Β Β Β  printf(“%d\n”,abc);
printf(“%d\n”,bit);
printf(“%d\n”, bit1);*/
if(bit1<5)
printf(“%d”, abc);
if(bit1>5)
printf(“%d”, abc+1);
if(bit1==5)ell
{
if(bit%2==1)
printf(“%d”,abc+1);
else
printf(“%d”,abc);

}
}
Felt really good after seeing my entire logic working right in front of my eyes.
This went a little long but was worth writing πŸ™‚

P.S – Dry run really helps πŸ™‚

Advertisements

The Saga Continues !

Hello again πŸ™‚
Well , the break was on purpose.
Please care to deal with the fact that i am back to college. The same old torture has begun. Can’t explain how badly it took away from me all the beautiful time i spent with myself and my laptop.
I have yet not hugged the subjects because i hate them. The two subjects i am basically focusing on is – Automata and Java.
So far , i have dealt only with classes and objects but yes , wrote a lot of codes to get my concept clear
** acting like a boss in my class πŸ˜‰
Along with C and python , java is also trying to fit it’s pieces in me.. Well , i am a little confused and going through a shortage of time but still will have to manage the trio.
ah ! it’s going to be a lot of fun.
I am slowly getting isolated from the friend circle of mine. They barely talk to me now.
** Kushal da , you were right πŸ™‚ i experienced it a little late πŸ™‚
I am trying with all my level to do my best. I wish i get along properly with all my plans.
Shall get back very soon.

Busy days keeps one happy :)

These days i am loving being busy..
The last few days have been properly giving me doses so that i can continue with all the plans i have been building up in my head.
To begin..
1. I have been reading the summer training logs of the last year.
2. not only from here – try.github.io but also from the logs and through differents sites i have been learning about git. Confident enough to know git properly enough now.
** i always had a tough time learning about git 😦
3. Reading the pym book in pieces and solving as many questions as possible.
4. I am helping 2-3 people on IRC and explaining them a few things too (feels so nice to do this)
and also i had a few study tips from kushal da today πŸ™‚

I hope i finish all my work little soon and take a lead with few steps ahead. I hope things work out pretty well this time.
and also i made few new friends today , in the outside world as well as on IRC.

P.S – Few times, i feel like i am on cloud 9 πŸ™‚

As Time Goes By…

A very warm morning welcomed me today. Though i had a really tough night.
For the first time i enjoyed the night charm of IRC πŸ™‚Β  I stayed up there from 3-6 am and gathered lots of information from the people i had a conversation with..
My mother makes fuss and asks me to shut down my laptop as i spend my entire day sitting by its sides which ultimately lets me lend her very less time.. :/
I guess what will she do after i am back to dgp. Holidays have to come to an end 😦
** atleast noone will stop me from staying awake late night.

I have yet to decide if i will be attending the tech fest at kharagpur. It’s a technical fest that happens every year. My little group is very excited to go and experience the environment.
I don’t know if i am excited too 😐

Our college , Dr. B.C Roy Engineering College, is also going to conduct a Fest which will be happening by the first week of march.
Hope it goes well this time.

“” and one spark that i wanted to mention – I am a little involved these days with a game – clash of clans.. Before i even started playing, my brother said me- ” That’s no girl’s game”.
.I heard a lot about the game,saw pictures, posts on facebook related to CoC.. never thought i could be so interested in playing it too.. πŸ™‚ I am spending a little time playing it now and then.

Now, If i talk about what i am doing these days, i am doing what i am told to do by – Kushal da and Sayan da.Β  I spend most of my time working on things because i don’t feel like wasting a single second anymore..
I have lots of things on my plate and i need to do everything superfast and also, My fourth semesters are about to begin ( College makes me sad always 😦 )
That is all. See you all soon !!

P.S – Rise up and show yourself of everything you are capable of πŸ™‚

and i got a license :)

Can’t really express how good it feels to touch the keyboard of my laptop again πŸ™‚ I am so thrilled.

Well , there are a lot of things i want to talk about !I will start with getting back to work again πŸ™‚ I feel sorry for having gone on a long break ( it wasn’t intentional though )
I feel so good today πŸ™‚ Words can’t explain the feeling.
Today , since morning i had been planning to get into IRC. Though i was a little late.
I was too excited and had a good quiet conversation with Kushal Da, Sayan Da , Castiel etc. All they do is boost you up to such a level that you never feel down. I took a lot of motivation from them. I feel blessed.
Here is a linkΒ  – http://norvig.com/21-days.html. Feel free to read it. I almost have read it thrice.
At last, i would conclude today ( because i have got a lot of thing to do )Β  by just wishing that everything goes well this time.

P.S – Thankyou #dgplug members for making me feel good about myself.

2016 – Another Perfect Start.

Went a little back to see and yes, i copied the title from my very first post.
It is exactly an year. I feel bad that i was not so loyal with wordpress for the past few months.
* Not making a fake promise, but i assure and will try to be the most loyal user wordpress has.

Talking about the last year i spent, it was a complete ride of all the emotions counting in the present day.
I started the day with wishing the most special people of my life –Β  my parents andΒ  bnprk πŸ™‚
and i had been searching for few people so that i could wish them too.

A very Happy New Year to all the dgplug members πŸ™‚ especially people who helped me through out.
Many unexpected things happened this year.
My fingers are crossed and i hope things to get perfect as soon as possible.

I am spending my new year, here at chennai.. A beautiful place ( mentioning it so that i remember it the very next year i.e 2017 πŸ˜› )
** i had been here already but it is the first time i am seeing everything with my wide eyes after i have grown up so big.

Talking about the technical part i am dealing with, had been through a lot of chaos lately, couldn’t so properly concentrate on everything.
I believe that action speaks louder than words. There is nothing else i would say. I would be getting back to my world as soon as i reach home.
It wont take a long time anymore. Will be back on IRC too πŸ™‚

P.S – I feel good now and i promise i will make good use of the time i am provided with. May this year proves itself to be a good one for everyone πŸ™‚ See you all soon.

Alive :P

Okay , i am certainly leaving no doubts to prove that i seriously am not a girl of my words.. 😦 ( and i am so sorry for that)
Today afternoon , a phone call got me back into senses πŸ™‚ It was him , yes , kushal da.
Well , not a long conversation but it was enough to roll me off the bed !
I agree i have become a little ignorant ( that comes out as i am very less involved in writing a blog ). I wont pledge anything but would surely put in efforts to get back.
Again taking a start with python , django , C , i am all through to see the wonders πŸ™‚
Shall write in again very soon !!

Overflow.

Hi again !
Trust me , i too am upset on going for “long break” these days 😦
No , i have not made any excuses up in my mind , the only trouble was with – the little mess that was created in my head.
Well , no issues in sharing them..
First , i am always messed up with basically two things – “What to learn” and “How to Learn and implement”
The problem mostly is with the implementing part.
Sadness is , when you understand everything yet you can’t submit a feedback ( it frustrates ME )
Like i discussed with a mentor of mine , there are lots of things on the plate as for now ..
Starting with , “College”. Entering into 3rd semester ( 2nd year ) is no less than a pain.. The burden got +1’ed. Shaked hands with completely new subjects like , Data Structure , Computer Organization ( mentioning these two as they are not only screwing me up but are also my ” departmental” subjects )
Data Structure – A world of fun with lots of algorithms as rides and topics such as – Stacks , Queue , Linked list , Trees etc as special rides
The more i learn , the more i will share, currently i am in hands with linked lists and stacks. Learning the basics and also helping myself to write ” proper codes ” πŸ™‚
Computer Organization – Three weeks passed and not that i have ever missed a class of the subject , butΒ  feel sorry for i cannot talk about the rides || special rides it is going to provide.
Though the subject deals with how the hardware components operate and the way they are connected together to form the computer system , it provides knowledge of the analog part too.
Next , C is still with me πŸ™‚ i am yet to finish few topics of C very properly.
Thanks to kushal da , for giving me an online tutorial for C. Here it is – https://www.youtube.com/playlist?list=PLEEAD1D187A7CCD6C
Very helpful πŸ™‚
Oh yes ! My Summer Training is still going on , i am so far a happy and successful part of it. There were lots of topics covered , in Python – The Basics , About Loops ,Β  Lists , Strings , Exceptions , and today’s session on Classes etc.
Things are fine so far πŸ™‚

Shall switch again ( soon )
P.S – One can’t really have a better life than this ( Keep wondering if it was a satire πŸ˜‰ )

A Month and Three Days More

Hi all πŸ™‚

There was no reason for the break i took this time except one – i was a little busy with the summer training and returning back to college.
Yes , finally the “Happy Days” i was leading are over as college came back into being. The fruitful days are up 😦 and yes and yes that is saddest part till now.

As i discontinued writing up , i couldn’tΒ  fully share things bout the summer training.
The topics covered after the last day were productive enough and included sessions of topics i never had quite a knowledge of.. Well , i would say i am still working on them.

DAY 7th – DAY 8th — 8th July’15 & 10th July ’15

The next sessions consisted of Version Control System.. basically Mercurial and Git.
We were given proper hands-on session to know about them and it was very properly explained as well
( I shall ( though not very soon ) ) would provide blogs on all i know about VCS as i have yet to learn a few more things.

DAY 9th – DAY 10th — 13th July’15 , 15th July’ 15 & 17th July’ 15

After VCS , Sayan and rtnpro ( their IRC nicks ) gave us details about how to create web pages.. It wont be quite tough to catch that the topics covered were – HTML and CSS.
The third was about CSS properties.
We came to know about a lot of properties used in CSS ( shall provide a blog on this too πŸ™‚ )
The sessions were fun and we were stuffed with all the basics of the above two πŸ™‚
We successfully created our web page ( which was given as an assignment )

DAY 11th – Day 12th — 20st July’ 15 & 22nd July ‘ 15

And the most awaited , ” python” was finally introduced amongst us.
The first was just an hour session and contained onlyΒ  few basics. The second day of python contained about – Functions , Modules and Looping.
Most of which i knew about and also we were given two codes to write during the session itself πŸ™‚

P.S – Happy Days are yet alive as long as there is something so much exciting happening along !

Ignited :D

πŸ™‚ πŸ™‚ πŸ™‚

And yes , i am bearing this smile right now ( there is no reason being sad anymore )
This is Happiness afterall – A long summer holiday where you get a spare time after lots of struggle , sit with your laptop and read and read and read πŸ™‚

DAY 6 – 6th July ‘ 2015

Today was the first hands-on session we had.
Though i found all the sessions amazing so far , but today was cherry on the top πŸ™‚
We were provided an email to get *python-sphinx* on our systems.
Today’s session was all about documentation and not a lot of efforts was required to do that ( i mean to create our first documentation ) using sphinx. It was fun and every dgplug member enjoyed ( observed it from the feedback )
Here is a little more about sphinx – http://sphinx-doc.org/tutorial.html#setting-up-the-documentation-sources ( This is what i went through ) to know more bits of sphinx.

P.S – Looking forward for a new day , that involves more learning πŸ™‚