sumnumber1number2 to calculate sum printfThe sum of two numbers is d sum to

Sumnumber1number2 to calculate sum printfthe sum of

This preview shows page 1 - 3 out of 3 pages.

sum=number1+number2; // to calculate sum printf("The sum of two numbers is : %d " ,sum); // to print sum return 0; Page 1 of 3
Image of page 1
} // end of main Overview of C Program: The general format of any C program is : preprocessor directives int main (void ) { variable declarations; statements; } Complete overview of an C Program is explained in following example : /* Displays the user's nickname and the current year in a welcoming message. */ #include <stdio.h> /* printf, scanf definitions */ int main(void) // main function { char letter_1, letter_2, letter_3 , letter_4; /* four letters */ int year; /* current year */ printf("Enter a 4-letter nickname and press return : "); scanf("%c %c %c %c", &letter_1, &letter_2, &letter_3, &letter_4); // to read 4 letters from keyboard printf("Enter the current year and press return :"); scanf("%d", &year); // to read year from keyboard printf("Welcome, %c%c%c%c . %d is a great year to study C!\n", letter_1, letter_2, letter_3,letter_4, year); return (0); } // end of main Sample Output: Enter a 4-letter nickname and press return : Omar Enter the current year and press return : 2007 Welcome, Omar. 2007 is a great year to study C! Reserved Key Words: All reserved key words in C language appear in lower case ; they have special meaning in C and cannot be used for any other purposes at any place . In our previous programs reserved key words are : int , char , void , double , return etc. A complete list of reserved key words is present in your text book at Appendix G .
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes