Download presentation

Presentation is loading. Please wait.

Published byJourney Hoad Modified over 3 years ago

1
1 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230

2
2 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 Comments are set between /* and */

3
3 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 The C pre-processor replaces this directive with the contents of the stdio.h header file from the standard C library.

4
4 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 Every C program must have one main function.

5
5 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 Each variable must be explicitly defined as a specific type.

6
6 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 The stdio library defines the printf() function for creating output.

7
7 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 The stdio library defines the printf() function for creating output. \n is the newline character

8
8 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 The stdio library defines the scanf() function for capturing input.

9
9 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 %d tells scanf() to interpret the input as a decimal value

10
10 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 The = operator is used for assignment. The * operator is used for multiplication.

11
11 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d", &number); result = number *10; printf("The number multiplied by 10 equals %d\n", result); } Sample Program Output Type in a number 23 The number multiplied by 10 equals 230 %d tells printf() to treat the value of the result variable as a decimal nbr.

Similar presentations

Presentation is loading. Please wait....

OK

Chapter 15 Strings as Character Arrays

Chapter 15 Strings as Character Arrays

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on structure of foreign exchange market Ppt on food subsidy in india Ppt on economic systems Ppt on power grid synchronization Ppt on disaster management in india Ppt on hindu religion wikipedia Convert pdf ppt to ppt online viewer Ppt on solid dielectrics inc Ppt on interest rate risk Ppt on life study of mathematician rene