Wednesday, November 20, 2013

QBASIC Programmings

Part I
WAP to display:

1.      J
JA
JAG
JAGA
JAGAT
=>
REM
CLS
S$=”JAGAT”
FOR I = 1 TO LEN(S$)
PRINT LEFT$(S$, I)
NEXT I
END

2.      T
AT
GAT
AGAT
JAGAT
=>
REM
CLS
S$=”JAGAT”
FOR I =1 TO LEN(S$)
PRINT RIGHT$(S$, I)
NEXT I
END

3.      JAGAT
AGAT
GAT
AT
T
=>
REM
CLS
S$=”JAGAT”
FOR I = LEN (S$) TO  1 STEP -1
PRINT RIGHT$(S$, I)
NEXT I
END
 
4.      JAGAT
JAGA
JAG
JA
J
=>
REM
CLS
S$=”JAGAT”
FOR I = LEN(S$) TO 1 STEP -1
PRINT LEFT$(S$, I)
NEXT I
END

5.      J
A
G
A
T
=>
REM
CLS
S$=”JAGAT”
FOR I = 1 TO LEN(S$)
PRINT MID$(S$, I, 1)
NEXT I
END

6.      T
A
G
A
J
=>
REM
CLS
S$=”JAGAT”
FOR I = LEN (S$) TO 1 STEP -1
PRINT MID$(S$, I, 1)
NEXT I
END

7.      JAGAT
AGA
G
=>
REM
CLS
S$=”JAGAT”
A=5
FOR I = 1 TO 3
PRINT MID$(S$, I, A)
A=A-2
NEXT I
END

8.     G
AGA
JAGAT
=>
REM
CLS
S$=”JAGAT”
A=1
FOR I = 3 TO 1 STEP -1
PRINT MID$(S$, I, A)
A=A+2
NEXT I
END

9.     *
**
***
****
*****
=>
REM
CLS
S$=”*****”
FOR I = 1 TO LEN(S$)
PRINT LEFT$(S$, I)
NEXT I
END

10. *****
****
***
**
*
=>
REM
CLS
S$=”*****”
FOR I = LEN(S$) TO 1 STEP -1
PRINT LEFT$(S$, I)
NEXT I
END

Part II
WAP to enter any number and display

1.      Sum of digits.
=>
REM
CLS
S=0
INPUT ”Enter any number”; N
WHILE N<>0
R=N MOD 10
S=S+R
N=N\10
WEND
PRINT ”Sum of digits is”; S
END

2.      Sum of even digits.
=>
REM
CLS
S=0
INPUT ”Enter any number”; N
WHILE N<>0
R=N MOD 10
IF R MOD  2=0 THEN S=S+R
N=N\10
WEND
PRINT “Sum of even digits is”; S
END

3.      Sum of odd digits.
=>
REM
CLS
S=0
INPUT ”Enter any number”; N
WHILE N<>0
R=N MOD 10
IF R MOD 2=1 THEN S=S+R
N=N\10
WEND
PRINT “Sum of odd digits is”; S
END

4.      Sum of square of digits.
=>
REM
CLS
S=0
INPUT “Enter a  number”; N
WHILE N<>0
R= N MOD 10
S = S+R^2
N= N\10
WEND
PRINT ”Sum of square of digits is”;  S
END

5.      Sum of cube of digits.
=>
REM
CLS
S=0
INPUT “Enter a number”; N
WHILE N<>0
R=N MOD 10
S=S+R^3
N=N\10
WEND
PRINT ”Sum of cube of digits is”; S
END  

6.      Sum of square of even digits.
=>
REM
CLS
S=0
INPUT “Enter a number”; N
WHILE N<>0
R=N MOD 10
IF R MOD 2=0 THEN S=S+R^2
N=N\10
WEND
PRINT ”Sum of square of even digits is”; S
END

7.      Sum of square of odd digits.
=>
REM
CLS
S=0
INPUT ”Enter a number”; N
WHILE N<>0
R=NMOD 10
IF R MOD 2=1 THEN S=S+R^2
N=N\10
WEND
PRINT “Sum of square of odd digits is”; S
END

8.     Sum of cube of even digits.
=>
REM
CLS
S=0
INPUT “Enter a number”; N
WHILE N<>0
R=N MOD 10
IF R MOD 2=0 THEN S=S+R^3
N=N\10
WEND
PRINT ”Sum of cube of even digits is”; S
END

9.     Sum of cube of odd digits.
=>
REM
CLS
S=0
INPUT “Enter a number”; N
WHILE N<>0
R=N MOD 10
IF R MOD 2=1 THEN S=S+R^3
N=N\10
WEND
PRINT ”Sum of cube of odd digits is”; S
END

10. Even digits.
=>
REM
CLS
INPUT “Enter a number”; N
WHILE N<>0
R=N MOD 10
IF R MOD 2=0 THEN PRINT R
N=N\10
WEND
END

11.  Odd digits.
=>
REM
CLS
INPUT “Enter a number”; N
WHILE N<>0
R=N MOD 10
IF R MOD 2=1 THEN PRINT R
N=N\10
WEND
END

Part III
WAP to enter any number and display:

1.      WAP to display reverse the given digits.
=>
REM
CLS
     S=0
INPUT “Enter a number”; N
WHILE N<>0
R=N MOD 10
S=S * 10 + R
N=N\10
WEND
PRINT “The reverse number is”; S
END

2.      WAP to display product of entered digits.
=>
REM
CLS
     P=1
INPUT “Enter a number”; N
WHILE N<>0
R= N MOD 10
P= P *R
N= N\10
WEND
PRINT “The product of entered digits is”; P
END

3.      WAP to display product of even digits.
=>
REM
CLS
     P=1
INPUT “Enter a number”; N
WHILE N<>0
R= N MOD 10
IF R MOD 2=0 THEN P= P*R
N=N\10
WEND
PRINT “The product of even digits is”; P
END

4.      WAP to display product of odd digits.
=>
REM
CLS
     P=1
INPUT “Enter a number”; N
WHILE N<>0
R= N MOD 10
IF R MOD 2=1 THEN P= P*R
N=N\10
WEND
PRINT “The product of odd digits is”; P
END

5.      WAP to count total number of entered digits.
=>
REM
CLS
S=0
INPUT ”Enter a number”; N
WHILE N<>0
R= N MOD 10
S= S+1
N=N\10
WEND
PRINT “The total number of digits is”; S
END

6.      WAP to count total number of even digits.
=>
REM
CLS
S=0
INPUT “Enter a number”; N
WHILE N<>0
R= N MOD 10
IF R MOD 2 = 0 THEN S = S+1
N= N\10
WEND
PRINT “The total number of even digits is”; S
END

7.      WAP to count total number of odd digits.
=>
REM
CLS
S=0
INPUT “Enter a number”; N
WHILE N<>0
R= N MOD 10
IF R MOD 2 = 1 THEN S = S+1
N= N\10
WEND
PRINT “The total number of odd digits is”; S
END

8.     WAP to check whether the given number is Palindrome or not.
=>
REM
CLS
S=0
INPUT ”Enter a number”; N
A=N
WHILE N<>0
R= N MOD 10
S= S * 10 + R
N= N\10
WEND
IF A=S THEN
PRINT “The given number is palindrome”
ELSE
PRINT ”The given number is not palindrome”
END IF
END

9.     WAP to check whether the given number is Armstrong or not.
=>
REM
CLS
S=0
     INPUT “Enter any number”; N
A=N
WHILE N <>0
     R= N MOD 10
S=S+R^3
N=N\10
WEND
     IF A=S THEN
PRINT “The given number is Armstrong”
ELSE
PRINT “The given number is not Armstrong”
END IF
END



Wednesday, November 6, 2013

The Alchemist

Know the writer:

Paulo Coelho was born in Brazil and has become one of the most widely read authors in the world today, the recipient of numerous prestigious international awards. Paulo Coelho is a storyteller with the power to inspire nations and to change people’s lives. 

Summary:

Once there was an Andalusian shepherd who was very friendly with his sheeps, named Santiago.  He had a repeating dream, in which he goes in an adventure and finds treasure in the Egyptian Pyramids. Being fascinated by his recurring dream, he wants to achieve the treasure in order to be rich and marry the Merchant’s daughter. He then goes to a gypsy so as to interpret the dream for him. The gypsy after interpreting the dream suggests Santiago to go to Egypt and unleash the secret there.
Later he meets an old man named Melchizedek, who was the King of Salem, who provides a lot of courage and self-confidence by encouraging him to follow his destiny. He then urges Santiago to sell his sheep to him so that the old man would provide information to him. The old man however didn’t inform Santiago about the treasure, but suggested him to follow the Omen and handed him two stones, Urim and Thummim which would provide the answer when he could not read his omens. Then he sets for his journey.

When he arrive Tangier, he gets robbed due to which he gets startled and helpless. He spends the night there and the following day, he finds a local crystal merchant’s shop where works for almost a year and increases the business of the merchant.  Santiago almost forgets his aims but later he remembers it and then decides to move on.
He then joins the caravan crossing the Sahara desert to head Egypt, where he meets an Englishman who was studying to become an Alchemist. He learns many secrets, techniques and lessons from the Englishman. He later falls in love with Fatima, who lived in the oasis where the caravan had stopped due to the war. Santiago proposes Fatima to marry him, but she tells that she would marry him only after finding his treasure.

Santiago then meets an alchemist who guides Santiago to the pyramids and shares him his wisdom about the Soul of the World. In the last few days left to reach Egypt, the alchemist and Santiago get caught by a tribal group but they get set free due to the ingenuity of the alchemist. Then the alchemist gives Santiago the gold i.e. the Philosopher’s Stone that would lead him to the pyramid.
Santiago finally reaches the pyramid and starts digging there but does not find the treasure.  While digging two men see him and beats him for digging. After listening to the dream of Santiago, one of the two men says that the treasure might be the one buried under the abandoned church in Spain. He again starts his journey back to Spain where he ultimately finds the treasure and then plans for his re-union with Fatima……

My views:

“The Alchemist” is a magical story which teaches us and encourages us about the necessity of wisdom of listening to our hearts, learning to read the omens strewn along life’ s path and above all following our dreams.  The main knowledge what we can gain from this novel is that, it’s not about our journey or our destiny but what really matters is the thing that we learn during the journey and many new ideas that we achieve on our way.  This novel ideally concentrates on the ups and downs that come across our lives when we want to achieve our goals in life. I was really interested to know about the adventure of the shepherd Santiago and his destiny. It is a self-help novel, i.e. it suggests one on living for our dream and encourages people to follow their dream. The thing that I learnt from this novel is that when we really want something to happen, the whole universe conspires so that our wish comes true.

Tuesday, November 5, 2013

Homework of Dashain and Tihar Vacation

Choose three Head of States (Presidents) of any countries and prepare a detailed biography of each describing at least within five paragraphs and also attach 4 photographs.
1.  Nelson Mandela:
Nelson Rolihlahla Mandela was born on 18th July 1918 A.D. He is a South African anti –apartheid revolutionary and politician who served as President of South Africa from 1994 to 1999. He was the first black South African to hold the office and first elected in a fully representative, multiracial election. His government focused on dismantling the legacy of apartheid through tackling institutionalized racism, poverty and inequality, and fostering racial reconciliation.
Mandela was born in Thimbu royal family so he attended Fort Hare University and University of Witwatersrand, where he studied law. Then he became involved in anti-colonial politics, joining African National Congress (ANC) and became a founding member of its youth League. After the Afrikaner nationalists of the National Party came to power in 1948 and began implementing the policy of apartheid, he rose to prominence in the ANC’s 1952.

Mandela served as the president of African National Congress (ANC) politically an African nationalist and democratic socialist from 1991 to 1997. Becoming ANC president, Mandela published his autobiography and led negotiations with President F.W. de Klerk to abolish apartheid and establish multiracial elections in 1994, in which he led the ANC to victory. Mandela was the secretary General of the Non-Aligned Movement from 1998 to 1999. 

He also served 27 years in prison, fist on Robben Island and later in Pollsmoor Prison and Victor Vester Prison. An international lobbied for his release, which was granted in 1990 amid escalating civil strife. Soon, he was elected for President and formed a Government of National Unity in an attempt to defuse ethnic tensions. As a President, he promulgated a new constitution and initiated the Truth and Reconciliation Commission to investigate past human right abuse.

Continuing the former government’s liberal economic policy, his administration introduced measures to encourage land reform, cobat poverty and expand health care services. Internationally, he acted as mediator between Libya and the United Kingdom in Pan Am Flight 103 bombing trail, and oversaw military intervention in Lesotho. Mandela subsequently became an elder statesman focusing on charitable work in combating poverty and HIV/AIDS through Nelson Mandela Foundation.
Mandela has been a controversial figure for much of his life. Right-wing critics denounced him as a terrorist and communist sympathizer. He nevertheless gained international acclaim for his anti-colonial and anti-apartheid stance, having received more than 250 honours, including the 1993 Nobel Prize, the US President Medal of Freedom, and the Soviet Order of Lenin. He is held in deep respect within South Africa, where he is often referred to his Xhosa clan name, Madiba; he is often bescribed as “the father of the nation”.


2. Pranab Kumar Mukherjee:
Pranab Kumar Mukherjee was born on 11 December 1935 A.D. He was born to a Bengali family at village Mirat in Bribhum district in the Bengal province of British India. His father, Kamada Kinkar Mukherjee, was active in the Indian independence movement and was a member of West Bengal Legislative Council between 1952 and 1964 as a representative of the Indian National Congress and was the member of AICC. His mother was Rajlakshmi Mukherjee.

He attended the Suri Vidyasagar College in Suri(Birbhum), then affiliated with the University of Calcutta. He subsequently earned an MA degree in Political science and history and also an LLB degree from the department of law of the University of Calcutta. HE began his career as an upper-division clerk in the office of the Deputy Accountant-General in Calcutta. In 1963, he began teaching political science at Vidyasagar College and he also worked as a journalist with the Desher Dak before entering politics.

Pranab Mukherjee is 13th and the current President of India, in office since July 2012. In a political career spanning six decades, Mukherjee was a senior leader of the Indian National Congress and occupied several ministerial portfolios in the Government of India. Prior to his election as President, Mukherjee was Union Finance Minister from 2009 to 2012 and the Congress Party’s top troubleshooter.


Mukherjee got his break in politics in 1969 when Prime Minister Indira Gandhi helped him get elected to the Rajya Sabha, the upper house of Parliament, on a Congress ticket. Following a meteoric rise, he became one of Indira Gandhi’s most trusted person and a minister in her cabinet by 1973. Mukherjee’s service in a number of ministerial capacities culminated in his first stint as finance minister in 1982-1984. Mukherjee was also Leader of the House in the Rajya Sabha from 1980 to 1985.

Mukherjee was sidelined from the Congress during the premiership of Rajiv Gandi, Indira’s son. He lost in ensuing power struggle. He formed his own party, the Rashtriya Samajwadi Congress, which merged with the Congress in 1989 after reaching a compromise with Rajiv Gandhi. Mukherjee’s political career revived when Primw Minister P.V. Narasimha Rao appointed him Planning Comission held in 1991 and foreign minister in 1995.

From then until his resignation in 2012, Mukhrejee was partically number-two in Prime Minister Manmohan Singh’s government. He held a number of key cabinet portfolios, External Affairs (2006-1009) and Finance (2009-2012)-apart from heading several Groups of Ministers and being Leader of the House in the Lok Sabha. After securing the UPA’s nomination for the country’s presidency, in July 2012 Mukherjee comfortably defeated P.A. Sangma in the race to Rashtrapati Bhavan, winning 70% of th electoral-college vote.


3.  Jose Mujica:
Jose Alberto Pepe Mujica Cardano was born on 20 May 1935, to Demetrio Mujica, of Spanish Basque ancestry and Lucy Cardano, a daughter of Italian immigrants. In his youth, Mujica was active in the National Praty, where he became close to Enrique Erro. His mother’s family was composed of very poor Italian immigrants from Liguria; the surname Cordano is original of the Fontanabuona Valley, in the provinceof Genoa.His fathe was a small farmer who went bankrupt shortly before his death in 1940, when Mujica was 5.

In 2005, Mujica married Lucia Topolancy, a fellow Tupamaro member and current senator, ater many years of co-habitation. They have no children and live on ann austee farm in the outskits of Montevideo where they cultivate chrysanthemums as an economic activity,having declined to live in the opulent presidential place. His humble lifestyle is reflected by his choice of an aging Volkswagen Beetle as transport. His wife owns the farm they live on.

Jose is a Uruguayan politician and President of Uruguay since 2010. A former guerrilla fighter and a member of the Broad Front coalition of left-wing parties, Mujica was Minister of Livestock, Agriculture and fisheries from 2005 top 2008 and a Senator Afterwards. As the candidate of the Board Front, he won the 2009 presidential election and took office as President on 1st March 2010.

He has been described as “the world’s poorest president”, as he donates around 90% of his $12,000 monthly salary to charities to benefit poor people and small entrepreneurs. He formed a cabinet made up of politicians from the different sectors of the Board Front, conceding the economics area to aides of his vice president Danilo Astori. Mujica was the first former guerrilla fighter to become President in Uruguay. In general terms, his government is a continuation of the previous one.

In June 2012, his government made a move to legalize state-controlled sales of marijuana in order to fight drug-related crimes and health issues and stated that they would ask global leaders to do the same. Time magazine also featured an article on the matter. He also provided treatment to the most serious abusers, much like what is done with alcoholics. Then in September 2013, Mujica addressed the United Nations General Assembly, with a very long discourse devoted to humanity and globalization.