Fibonacci c program


Source code to display Fibonacci series up to n terms


/* Displaying Fibonacci sequence up to nth term where n is entered by user. */ #include <stdio.h> int main() {
  int count, n, t1=0, t2=1, display=0;  printf("Enter number of terms: ");
  scanf("%d",&n);
  printf("Fibonacci Series: %d+%d+", t1, t2); /* Displaying first two terms */  count=2;    /* count=2 because first two terms are already displayed. */ while (count<n) {  display=t1+t2;  t1=t2;  t2=display;
      ++count;
      printf("%d+",display); } return 0; }
Output
Enter number of terms: 10
Fibonacci Series: 0+1+1+2+3+5+8+13+21+34+
Suppose, instead of number of terms, you want to display the Fibonacci series util the term is less than certain number entered by user. Then, this can be done using source code below:

/* Displaying Fibonacci series up to certain number entered by user. */ #include <stdio.h>
int main() {
  int t1=0, t2=1, display=0, num;  printf("Enter an integer: ");
  scanf("%d",&num);  printf("Fibonacci Series: %d+%d+", t1, t2); /* Displaying first two terms */  display=t1+t2; while(display<num)
  {
      printf("%d+",display);  t1=t2;  t2=display;  display=t1+t2;
  } return 0; }
Output

Enter an integer: 200
Fibonacci Series: 0+1+1+2+3+5+8+13+21+34+55+89+144+

0 comments:

Communication Skills


Here are the notes of communication skills, specially for you…
they are in the syllabus of 2nd semester in most of the technical universities….
check it out and hope this time you like it…….
                                                                                                  What is Body Language?
Ans. It is the communication of personal feelings, emotions, attitudes, thoughts through body movements – gestures, postures, facial expression, walking styles, position and distance – either consciously or involuntarily, more often subconsciously, and accompanied or unaccompanied by the spoken language.
The relation between the three main elements of communication; the verbal, the vocal, and the visual has been established by scientists in this way –
Verbal    7%
Vocal   38%
Visual   55%
Thus the visual is the most controllable and yet perhaps the most unconscious element of the message from sender to receiver.
Characteristics of Body Language
n      VOICE– It is an extraordinary human attribute. Our voice reveals our gender, age, background, level of education, emotional state etc. It has 3 chacteristics. Tone, volume, and pitch. tone is the quality of the voice. Volume is loudness or softness. Pitch is the high or low note of scale.

n       SILENCE – It is a tactful means of communications it may indicate several things. The terms ‘dead silence’, ‘stony silence’, ‘embarrassing silence’, show that silence has a multiple meanings. It means different things in different cultures.

n       FACIAL EXPRESSION – It is an obvious communicative factor. It influences many people. Several expression of face convey meanings even before we speak. A cheerful face, a gloomy face, are some of the communicative examples.
EYE CONTACT – It is a difficult form of communication. The comfort level of the eye contact is 3 seconds. Anything beyond that amounts to staring. Persons with lack of self confidence often avoid eye contact.
GESTURES – gestures are the movements of hand and body, they are natural and act as conjunction to verbal communication. They are used to emphasize or clarify a verbal message. they display our emotions while expressing a message.
POSTURE – It is the way we hold ourselves The way we sit, stand or hold our body contributes a lot communication
Graceful posture is a great asset in any profession.
SPACE – The amount of space we keep with  different people communicates our closeness to that person. The space of offices, a large office desk, a big car also suggest a position of importance.
TIME – Our use of time is an even more subtle non-verbal factor of communication. Time managements creates an impression of efficiency.
ENERGY – This aspect is hard to describe but easier to spot. People of high energy levels manage to create an atmosphere charged with enthusiasm and motivates other to do so. The high energy could be in in the form of intellectual, Spiritual or emotional energy. State of physical and mental health plays a big role in it.
CLOTHING – This creates the first impression of the people and is a powerful source of communication. It depends on colour, cut, fit, fabric etc.appropriateness o for the season and occasion is important.
APPEARANCE – Besides clothing other factors like appearance and hygiene plays an important role in positive communication. Personal hygiene and neatness, care of nails, hair , accessories like tie, belt, jewellery etc. contributes a lot to make a good impression. What ever you wear should be graceful and comfortable.
                                                                                                                            Letters
                                                                                                            Essentials of  Letter
       Although the letter is the most common form of written comm., We frequently overlook it’s importance. It stands as a test of one’s ability to think clearly and to use language effectively. Effective writings does not come by chance. It is a skill that can be developed. Some of the principles of effective writing are –
  • Promptness – As a rule, respond to the letter the day it is received .Otherwise you can acknowledge the letter and indicate how soon you can reply.
  • Accuracy – To be accurate you should check and double check you facts, figures, words, language, and tone. correct use of punctuation and grammar should be used. Instead of writing tomorrow or today the date should be mentioned.
  • Brevity -  Don’t overload your letter with irrelevant details. Brevity consists in saying what needs to be said. Being brief does not mean saying lesser than what the occasion demands. Brevity is not to be achieved at the cost of clarity.

  • Clarity – Clarity of language and tone is important in written comm. Our letter should be in positive language. Too many ‘sorry’ or ‘no’, ‘don’t’ should be avoided. correct spellings and caution in using homonyms should be exercised.

  • Salesmanship – Every letter going from your desk should be the ambassador of your firm. It must carry a message and enhance your reputation.

  • ‘You’ attitude – Write your letter by keeping in mind the receiver. Avoid I’s or we’s.
Essentials of effective writing
The Qualities necessary for business writings are called are called the four C’s of communications. They are Correctness,Clarity, Conciseness and courtesy.The other related qualities are completeness coherence, confidence and consideration.

CorrectnessA letter must be correct in every respect.
1. In spelling, grammar and the use of language.
2.In appearance and form of the layout.
3. In the information it conveys.
4.In tone formality and style.

Clarity—The message must be clear in the first reading.Clarity depends upon five factors:
1. Language must be simple
2.Sentences should be small.
3. Punctuation should be proper.
4. Words should give concrete details.
5. Logical sequence of ideas .

Courtesy-Courtesy is consideration for other people’s feelings.Some
 of the rules of courtesy are-
  1. Use of words like Please, Thank you & sorry etc.
  2. Opening the letter with polite words
  3. Showing sympathy when required
  4. Be attentive and prompt in replying the letter.

Conciseness-This means expressing in few words. That is writing
Should be precise and to the point.
1. Leave out unnecessary words
2. Leaving out unnecessary details

Structure of a letter
The following elements usually constitute the structure of a letter - 
  1. Heading
  2. Date
  3. Reference
  4. Inside address
  5. Attention or Subject
  6. Salutation
  7. Body
  8. Complimentary close
  9. Signature
  10. Identification marks
  11. Enclosures
REPORT WRITING
DEFINITION –The word report is derived from Latin word ‘reportare’ which means to carry back.It is therefore a description of event carried back to someone who was not present on the scene.  In short it is an assigned communication for a purpose and is meant for specific reader. Hence a report is a formal communication written for a specific purpose; it includes a description of procedures followed for collection and analysis of data, their significance, the conclusions drawn from them, and recommendations if required. They are of two types- formal and informal.It can be in a type of letter , memo, news item, periodic, routine, progress showing, lab reports or a proper format in detail form.

CHARACTERISTICS OF A REPORT
  • PRECISION – The writer should be very clear about the exact purpose of the report.
  • ACCURACY – all the facts mentioned should be accurate and demonstrated with the help of graphs, charts, pictogram etc.
  • RELEVANCE – The facts presented should be relevant and not left out. It should not mislead the reader.
  • READER ORIENTED – It is necessary that it is kept in mind the person for whom the report is meant.
  • RECOMMENDATION – they should be impartial without revealing any self-interest.
  • SIMPLE LANGUAGE – It should be in simple language free from poetic phrases.
  • BREVITY –It should be brief but not achieved at the cost of clarity.headings and subheadings should be included.
  • GRAMMATICAL ACCURACY — . It should use language that is concise concrete and grammatically correct.

PURPOSE OF A REPORT
It is primarily a source of information to the management to help in decision making, so its purpose is
  • To give information about a company’s activity, progress, plans and problems.
  • To record events for future reference.
  • To recommend specific action.
  • To justify and persuade readers about the need for action in controversial situations.
  • To present facts to the management to help decide the direction the business should choose.

STRUCTURE OF A REPORT
  • Cover
  • Title page
  • Acknowledgment
  • Table of contents
  • Executive summary
  • Introduction
  • Description
  • Conclusion
  • Recommendations
  • Appendix
  • List of references
  • Bibliography
  • Glossary
  • Index
WAIT FOR THE NEXT POST.
I WILL BE BACK WITH MORE COMMUNICATION NOTES…

0 comments: