Hello,
so after pages and pages of coding talk, many of you would have taken me for another comp geek. but i m back, and this time with some heady stuff.........
was just sitting idle in my room when a friend picked up the threads on share markets and investments. and i being a money buff just became too eager to experiment with this thing too, taking it just as a kind of sport. so i log on to all sorts of investment websites and delve into the business pages of today's news edition. i churn out names of companies which have been growing and giving good returns. armed with this knowledge, i start my quest for some hands-on experience. of course, i m too naive to just invest in the real sense of the word. but fortunately, there are people out there who help you learn. and what could be better than an investment simulating game. a quick search and many of them pop-up. i select the one which is most popular among my friends www.moneybhai.com. so i'm ready for the roll. "wow, yet another cool concept.bless you", was my first reaction on getting through the registration part of the site. so after some initial struggle i'm ready to invest. a silent prayer is sent to heaven,"let it be a prosperous affair".
"let's start with banks", my brain ordered and i complied, and i start with none other than the ICICI. i buy 100 shares at the quoted price and wait. the shares are taken and i have invested close to INR 50000 out of my (relatively huge :D)bundle of INR 25,00,000. the beginning is good, i begin with a profit, albeit very little ;).
but the happiness is not there to stay. today being a bad day for the banks, soon i realise my folly and turn to other avenues,this time the choice being TCS. the initial run is good, my losses are lessening but soon i start losing on this front too :(. but not to worry there are too many options and dont forget i have much too money too spare :).
so on a friends' advice i push more, investing in the likes of BAJAJ AUTO (taking cue from my dad), DLF, Infosys and many more. by the end of the day i am a big time buyer, with more than a dozen companies on my profile and 1000 shares by my side and a big chunk of my booty in the game now. some shares climb and some fall, but i retain them all(good rhyme isn't it!). a big time invester had once said "its not buying or selling that makes you rich. you become rich by holding.". so inspite of losses, my brave decision is to hold my (virtual) shares.
on the end of the first day, i am poorer by some 3,000 bucks :(. but still i am happy to have learnt the basics of this money game. now i am really looking forward to getting into the real pond. my friend, although slightly disheartened at the loss on this first day, is ready to be with me when we transform from virtual to real market. and this time the stakes will be higher but so will be our confidence and desire to win.
lets hope for the best
okies.
bye.
:)
Wednesday, April 23, 2008
Thursday, April 17, 2008
Numbers spiral in a triangular pattern...
Hello again...
After showing you my number's spiral in a rectangular pattern, now I would like to show you in a triangular pattern. For ex, if your input is 4, then the output pattern would be:
Hope you will find the code interesting...
Byeee
After showing you my number's spiral in a rectangular pattern, now I would like to show you in a triangular pattern. For ex, if your input is 4, then the output pattern would be:
01
12 13 02
11 16 15 14 03
10 09 08 07 06 05 04
Hope you will find the code interesting...
#include
int main()
{
int i, i2, j, k, l=1, m, n, o, p, q, r, s, sq, f[20][20];
char fl='f';
printf("Enter a number : ");
scanf("%d",&n);
sq = n * n;
for(j=1;j<=n;j++)
{
for(i=1;i<=((2*n) - 1);i++)
f[j][i] = 0;
}
i = n;
i2 = 1;
while(l<=sq)
{
if(fl == 'f')
{
f[i2][i] = l;
i2++;
i++;
if(f[i2][i]!=0 || i2>n)
{
i2 = i2 - 1;
i = i - 1 - 1;
fl = 'b';
}
l++;
}
else if(fl == 'b')
{
f[i2][i] = l;
i2 = i2;
i = i - 1;
if(f[i2][i] != 0 || i<=0)
{
fl = 'u';
i2--;
i = i + 1 + 1;
}
l++;
}
else if(fl == 'u')
{
f[i2][i] = l;
i2--;
i = i + 1;
if(f[i2][i] != 0)
{
fl = 'f';
i2 = i2 + 1;
i = i -1 + 1;
}
l++;
}
}
int z = 0, tt=1, kl;
for(j=1; j<=n; j++)
{
for(kl=1;kl<=((2*n) - 1);kl++){
if(f[j][kl] != 0)
{
if(f[j][kl] <10)
printf("0%d ",f[j][kl]);
else
printf("%d ",f[j][kl]);
}
else
printf(" ");
}
printf("\n\n");
}
return 0;
}
Byeee
Tuesday, April 15, 2008
A Number's Spiral.... in C
Hello again,
Recently, I had my Computer Programming online test... For that I was practising coding in C.. I am giving one of my program code.. which will display numbers in a spiral fashion...
For example, if you give input as 5 then the output would be:
01 02 03 04 05
16 17 18 19 06
15 24 25 20 07
14 23 22 21 08
13 12 11 10 09
Hope, you will find it interesting...
Byee...
Recently, I had my Computer Programming online test... For that I was practising coding in C.. I am giving one of my program code.. which will display numbers in a spiral fashion...
For example, if you give input as 5 then the output would be:
01 02 03 04 05
16 17 18 19 06
15 24 25 20 07
14 23 22 21 08
13 12 11 10 09
Hope, you will find it interesting...
//This spiral program is made by Neeraj Agarwal.
#include
int main()
{
int i, j, k, l, m, n, o, p, q, r, s, sq;
int f[20000];
char fl;
printf("Enter a number : ");
scanf("%d",&n);
sq = n * n;
for(j=1;j<=sq;j++)
f[j] = 0;
i=1;
fl = 'f';
l = 1;
while(l<=sq)
{
if(fl == 'f')
{
f[i] = l;
i = i + 1;
if(f[i]!=0 || (i-1)%n == 0)
{
i = i - 1 + n;
fl = 'd';
}
l++;
}
else if(fl == 'b')
{
f[i] = l;
i = i - 1;
if(f[i] != 0 || (i+1)%n==0)
{
fl = 'u';
i = i + 1 - n;
}
l++;
}
else if(fl == 'u')
{
f[i] = l;
i = i - n;
if(f[i] != 0 || i%n==0)
{
fl = 'f';
i = i + n + 1;
}
l++;
}
else if(fl == 'd')
{
f[i] = l;
i = i + n;
if((f[i] != 0 || i>sq))
{
fl = 'b';
i = i - n -1;
}
l++;
}
}
for(j=1; j<=sq; j++)
{
if((j-1)%n==0)
printf("\n");
if(f[j]<=9)
{
printf("0%d ",f[j]);
}
else
printf("%d ",f[j]);
}
return 0;
}
Byee...
Subscribe to:
Posts (Atom)