Premium Essay

C Program

In: Computers and Technology

Submitted By Jenfarala01
Words 653
Pages 3
Introduction to C Program
:
Define

basic terminologies Describe the steps in program planning & development Describe phases in writing a program Explain the steps in C program planning & development

Basic terminologies
Programming: planning, scheduling or performing a task or an event  Computer Programming: process of planning a sequence of steps for a computer to follow  Computer Program/Program: list of instructions to be performed by a computer or understood by the computer


Steps in Program Planning & Development
1. 2. 3. 4. 5.

Identification of the problem Problem Analysis Setting up an Algorithm Coding Running, Testing & Debugging

Steps in Program Planning & Development
1.

Identification of the problem knowing what the problem is

Steps in Program Planning & Development
2.Problem Analysis
   

Review the problem & understand carefully what you are asked to do Determine what is given(input) and what result/information must be produced(output) Assign names to each input and output Determine the manner of processing that must be done on the input data to come up with desired output

Steps in Program Planning & Development
3. Setting up an Algorithm Algorithm: a step-by-step process that if followed performs a specific task. This can be described in 2 ways: 1. natural language 2. graphical forms/notations

What Is an Algorithm?



An algorithm is nothing more than a finite list of instructions on how to perform a task. It is analogous to a cooking recipe a chef might use for preparing a food. Specifically, an algorithm has the following properties.

It must result in a finite series of actions.  The sequence of actions has a unique initial action.  Each action in the sequence has a unique successor.  The sequence terminates with either a solution, or a statement that the problem cannot be solved.
…...

Similar Documents

Free Essay

C Programs

...Exercise Based on basics of c and if else 1. Write a program to print ASCII value of a character entered. 2.Write a program to read a character and if the character entered is a upper case then convert it into lower case and vice versa. 3. Write a program to convert degree Fahrenheit into degree Celsius. 4. Write a program to check whether a number entered is a even number or odd number using switch case statement. 5. Write a program to read month of the year as an integer and print the month name using switch case statement. Exercise based on Loops 1. Write a program to print first 10 natural numbers using while loop, for loop and do while loop. 2. Write a program to calculate the sum of first 10 natural number using while loop, for loop do while loop. 3. Write a program to find the reverse of a number. 4. Write a program to check whether a number is palindrome or not. 5. Write a program to check whether a three digit number is a Armstrong number or not. 6. Write a program to print the numbers from m to n range. 7.write a program to calculate factorial of a number. 8.Write a program to check whether a number is prime or not. 9.Write a program to calculate the sum of digits of a number. 10.Write a program to print the following pattern using loops (a)* (b)1 (c) 1 (d) 0 ** 12 22 12 *** ...

Words: 662 - Pages: 3

Premium Essay

Lg C Program

... About The Tutorial C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system. C is the most widely used computer language. It keeps fluctuating at number one scale of popularity along with Java programming language, which is also equally popular and most widely used among modern software programmers. Audience This tutorial is designed for software programmers with a need to understand the C programming language starting from scratch. This tutorial will give you enough understanding on C programming language from where you can take yourself to higher level of expertise. Prerequisites Before proceeding with this tutorial, you should have a basic understanding of Computer Programming terminologies. A basic understanding of any of the programming languages will help you in understanding the C programming concepts and move fast on the learning track. Copyright & Disclaimer  Copyright 2014 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however,......

Words: 13419 - Pages: 54

Free Essay

String Reversal Program C

...calcuclation."); } } void main() { printf("Enter value of a and b:"); scanf("%d %d",&a,&b); displayIt(a,b); getch(); } * Write a program which perform following on string data * Reverse * Small to caps * Caps to small * Find a character from string * Replace a character REVERSE: #include<stdio.h> int main(){ char str[50]; char rev[50]; int i=-1,j=0; printf("Enter any string : "); scanf("%s",str); while(str[++i]!='\0'); while(i>=0) rev[j++] = str[--i]; rev[j]='\0'; printf("\nString Reversal is : %s \n",rev); return 0; } SMALL TO CAPS AND CAPS TO SMALL #include <ctype.h> #include <stdio.h> int main(void) {   char str[80];   int i;   printf("Enter a string: ");   gets(str);   for( i = 0; str[ i ]; i++)     str[ i ] = toupper( str[ i ] );   printf("%s\n", str); /* uppercase string */   for(i = 0; str[ i ]; i++)     str[i] = tolower(str[ i ]);   printf("%s\n", str); /* lowercase string */   return 0; } FIND A CHARACTER FROM STRING REPLACE A CHARACTER #include<stdio.h> #include<stdlib.h> int main(int argc, char *argv[]) { char string1[] = "hello"; printf("string1 %s\n", string1); printf("string1[2] %c\n", string1[2]); string1[2] = 'L'; printf("string1 %s\n", string1); return 0; }...

Words: 366 - Pages: 2

Free Essay

Design and Implement a C# Program That Will Gather Floating Point Numbers

...tutorial http://helpido.com/design-and-implement-a-c-program-that-will-gather-floating-point-numbers-and-determine-the-sum/ ---------------------------------------------------------------- Design and implement a C# program that will gather floating point numbers and determine the sum and average of the data entered. The program should use separate methods for inputting the data, calculating the sum, calculating the average, and displaying the results. A sentinel value should be used to indicate the user has completed entering their numbers. The output should display a message that includes the count of the numbers entered, the sum of the numbers and the average of the numbers. If the sum of the numbers is greater than 100, a warning message should be displayed indicating “values have exceeded a sum 100”. 2. Additional requirements include: a. Be sure to comment your code. b. Include a comprehensive set of application test data that you used to test your program. Your test data can be shown in a table that includes input data, expected output, actual output and pass/fail results from the test. Example application test data: InputExpected OutputActual OutputDid Test Pass? 10.0 20.0 30.0Sum = 60.0 Average = 20.0Sum = 60.0 Average = 20.0Y Additional test cases here. Be sure to test all logic. Submission requirements: Your deliverables include a C# file and a Word document. The C# file should be named Yournamep1.cs. Your word document...

Words: 276 - Pages: 2

Free Essay

Design a Program That Will Allow a User to Input a List of Your Family Members Along with Their Age and State Where They Reside C-Code

...#include <stdio.h> //Declare Prototype float getavg(int ageSum, int n); int main() { //Define variable family as number of loops and i as counter int family, i; printf("Enter the number of family members being submitted:"); scanf("%d", &family); //Declare rest of variables to hold the family names,states, ages, the sum of their ages, and the average of their ages char familynames[family][30], familystate[family][30]; int familymemberages[family], sum = 0; float averageAge; //Start loop and counter for (i=0; i < family; i++) { printf("\nPlease enter the following details for family member: \n" ); //Ask user to input first name printf("First name: "); scanf("%s", familynames[i]); //Store name in familynames //Ask user to input age printf("Age (in years): "); scanf("%d", &familymemberages[i]); //Store age in familymemberages //Ask user to input state they reside in printf("State of residence (by Abbreviation; Pa,Ny, Tx, etc...): "); scanf("%s", familystate[i]); //Store state in familystate //Sum of ages adding of all familymemberages sum += familymemberages[i]; } //Define the average age averageAge = getavg(sum, family); //Display the average age printf("\n\nThe average age among your family members is %.2f years\n", averageAge); //Display the list of members in Tx printf("List of members who live in Texas are: \n"); //Compare each charactors in string for Tx ...

Words: 313 - Pages: 2

Free Essay

Thesis

...1. Factorial program in cFactorial program in c: c code to find and print factorial of a number, three methods are given, first one uses for loop, second uses a function to find factorial and third using recursion. Factorial is represented using '!', so five factorial will be written as (5!), n factorial as (n!). Alson! = n*(n-1)*(n-2)*(n-3)...3.2.1 and zero factorial is defined as one i.e. 0! = 1. #include <stdio.h>   int main() { int c, n, fact = 1;   printf("Enter a number to calculate it's factorial\n"); scanf("%d", &n);   for (c = 1; c <= n; c++) fact = fact * c;   printf("Factorial of %d = %d\n", n, fact);   return 0; } 2. c program to check odd or evenc program to check odd or even: We will determine whether a number is odd or even by using different methods all are provided with a code in c language. As you have study in mathematics that in decimal number system even numbers are divisible by 2 while odd are not so we may use modulus operator(%) which returns remainder, For example 4%3 gives 1 ( remainder when four is divided by three). Even numbers are of the form 2*p and odd are of the form (2*p+1) where p is is an integer. #include<stdio.h>   main() { int n;   printf("Enter an integer\n"); scanf("%d",&n);   if ( n%2 == 0 ) printf("Even\n"); else printf("Odd\n");   return 0; } 3. C program to check whether input alphabet is a vowel or notThis code checks whether an input alphabet is a......

Words: 7510 - Pages: 31

Premium Essay

Programing Chapter 1

... An infinite loop is a flow of program logic that repeats and never ends. Software can be classified into two broad types System software and application software. Command line, a location on your computer screen at which you type text entries to communicate with the computer's operating system. The major difference between the two main programming styles in use today is programmer's focus during the earliest planning stages of a project. Graphical user interface(GUI) allows users to interact with a program in a graphical environment. The process of walking through a program's logic on paper before you actually write the program is called desk-checking.  Processing data items may involve organizing or sorting them,checking them for accuracy, or performing calculations with them. Every programming language has rules governing its word usage and punctuation. Using Pseudocode involves writing down all the steps you will use in a program. Before a programmer plans the logic of the program, he or she must understand the problem. F Software can be classified into two broad types: application software and programming software.  T Every programming language has rules governing its word usage and punctuation.  T Besides the popular, comprehensive programming languages such as Java and C++, many programmers use scripting languages such as Python, Lua, Perl, and PHP.  F Professional computer programmers write programs to satisfy their own......

Words: 1631 - Pages: 7

Free Essay

C++Language Compasion

...++Starting Out with Programming Logic and Design, 3rd Edition By Tony Gaddis C++ Language Companion or Copyright © 2013 Pearson Education, Inc. Table of Contents Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Introduction 3 Introduction to Computers and Programming 4 Input, Processing, and Output 9 Functions 19 Decision Structures and Boolean Logic 27 Repetition Structures 41 Value-Returning Functions 49 Input Validation 59 Arrays 61 Sorting and Searching Arrays 72 Files 77 Menu-Driven Programs 86 Text Processing 89 Recursion 95 Object-Oriented Programming 97 Page 2 Introduction Welcome to the C++ Language Companion for Starting Out with Programming Logic and Design, 3rd Edition, by Tony Gaddis. You can use this guide as a reference for the C++ Programming Language as you work through the textbook. Each chapter in this guide corresponds to the same numbered chapter in the textbook. As you work through a chapter in the textbook, you can refer to the corresponding chapter in this guide to see how the chapter's topics are implemented in the C++ programming language. In this book you will also find C++ versions of many of the pseudocode programs that are presented in the textbook. Note: This booklet does not have a chapter corresponding to Chapter 15 of your textbook because C++ does not provide a GUI programming library. Page 3 Chapter 1 This chapter......

Words: 1609 - Pages: 7

Free Essay

Python

... After reading this chapter and completing the exercises, you will be able to: * Understand basic elements of C programming * Debug C programs * Create, compile, and test C programs Text Reference: Chapter 10 – Developing UNIX/Linux Applications in C and C++ Programming Overview A computer program is a list of instructions given to a computer to make it perform a specific task or series of tasks. A programmer communicates these instructions to the computer in a language the computer understands. Computers, however, can only operate using binary code (1’s and 0’s), which makes a computer’s language very difficult for humans to understand. The solution to this problem is to create an intermediate language that both humans and computers can understand. These are called programming languages. Programmers create a list of instructions for the computer in a programming language such as C, C++, or Java. The C Programming Language The C programming language was released in 1973. C was created by Brian Kernighan, Dennis Ritchie and Ken Thompson working at Bell Labs. Both the UNIX and Linux operating systems are written in C. The C programming language is a high-level language because the code itself is written in relatively English-like statements. In 1978, Kernighan and Ritchie wrote "The C Programming Language," still one of the best C programming books available. The list of programming instructions is known as source code. It is text-based in......

Words: 2308 - Pages: 10

Premium Essay

Mrs Swathi

...which has been assigned a permanent label of "Asking Price". Which SAS program temporarily replaces the label "Asking Price" with the label "Sale Price" in the output? A. proc print data = sasuser.houses; label price = "Sale Price"; run; B. proc print data = sasuser.houses label; label price "Sale Price"; run; C. proc print data = sasuser.houses label; label price = "Sale Price"; run; D. proc print data = sasuser.houses; price = "Sale Price"; run; Answer: C Section: (none) QUESTION 2 The following GAS program is submitted: data work.empsalary; set work.people (in = inemp) work.money (in = insal); if insal and inemp; run; The SAS data set WORKPEOPLE has 5 observations, and the data set WORKMONEY has 7 observations. How many observations will the data set WORK.EMPSALARY contain? A. 0 B. 5 C. 7 D. 12 Answer: A Section: (none) 2 SAS Institute A00-211 Exam QUESTION 3 The following SAS program is submitted: data work.accounting; set work.dept1 work.dept2; jobcode = `FA1'; length jobcode $ 8; run; A character variable named JOBCODE is contained in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK. DEPT2 data set. What is the length of the variable JOBCODE in the output data set? A. 3 B. 5 C. 7 D. 8 Answer: B Section: (none) QUESTION 4 Given the SAS data set SASDATA.TWO: SASDATA.TWO XY ---The following SAS program is submitted: 3 SAS Institute A00-211 Exam data sasuser.one two......

Words: 4765 - Pages: 20

Free Essay

Test

...Teach Yourself C++ in 21 Days, Second Edition Introduction Week 1 at a Glance: Day 1 Getting Started Day 2 The Parts of a C++ Program Day 3 Variables and Constants Day 4 Expressions and Statements Day 5 Functions Day 6 Basic Classes Day 7 More Program Flow Week 1 in Review Week 2 at a Glance: Day 8 Pointers Day 9 References Day 10 Advanced Functions Day 11 Arrays Day 12 Inheritance Day 13 Polymorphism Day 14 Special Classes and Functions Week 2 in Review Week 3 at a Glance: Day 15 Advanced Inheritance Day 16 Streams Day 17 The Preprocessor Day 18 Object-Oriented Analysis and Design Day 19 Templates Day 20 Exceptions and Error Handling Day 21 Whats Next Week 3 in Review Appendixes A Operator Precedence B C++ Keywords C Binary and Hexadecimal D Answers Index Teach Yourself C++ in 21 Days, Second Edition Dedication This book is dedicated to the living memory of David Levine. Acknowledgments A second edition is a second chance to acknowledge and to thank those folks without whose support and help this book literally would have been impossible. First among them are Stacey, Robin, and Rachel Liberty. I must also thank everyone associated with my books, both at Sams and at Wrox press, for being professionals of the highest quality. The editors at Sams did a fantastic job, and I must especially acknowledge and thank Fran Hatton, Mary Ann Abramson, Greg Guntle, and Chris Denny. I have taught an online course based on this book for a couple years, and many folks......

Words: 4907 - Pages: 20

Free Essay

Management of Human Service

...Human Services Programs University of Phoenix This paper is in reference to case study 10. This paper will develop one process evaluation measure and one outcome evaluation measure to display the Greenby Community Mental Health Center’s effectiveness and efficiency. This paper will also discuss the scope and purpose of the process evaluation measure and outcome evaluation measure and how they influence the design. The Greenby Community Mental Health Center process evaluation measure suggests the consultation and education department needs to implement the address of the real questionable issue within the organization, and to evaluate the programs being offered through the organization. The questionable issue at the center involves the discontinuance of the consultation and education departments.   We understand the organization is facing an issue in regard to required service programs. We also understand the community mental health center has suggested as long as there is a director available the proposed suggestion will work, but doing so will take away workshops that have been instrumental to the program consumers. The implemented design includes dedicating a percentage of each professionals work towards Consultation and Education (Lewis, p. 242). A process evaluation is aimed at enhancing a current program by means of a formative analysis. It can be done anytime to describe and study the conceptualization, planning and implementation of a particular program. A......

Words: 1072 - Pages: 5

Premium Essay

Recognize an Ethical Issue (Software Sharing)

...ethical issue, since the company is merely non-existing with no more information available. Personally Jim and I should not share or the program even though the program is out of print. Socially illegal use of the program for business purposes will potentially hurt business client, in which deserve a legal software usage. The company that create and sell program C deserve to get credit or financial benefit that come as part of business deal between Jim and his client. To share the program C with Jim since it out of print would be unethical for business client and software company even though the program is out of print. An effort should be made to find a compatible program that can replace program C or it replacement. The best option for Jim is to let him come and use my computer when he needs program C, when all efforts have been done without a success. It is also imperative for Jim to consult his lawyer about the situation and ask for possible risk in the future. Jim’s client must also be informed about this approach and explain finding and facts that program C is irreplaceable. Get the Facts 3. What are the relevant facts of the case? What facts are unknown? Relevant facts in this case are Jim can only buy 2 out of three programs and he needs 3 program including program C to be able to design a kitchen layout and design. Program C software maker is probably bankrupt because no more information available. 4. What individuals and groups have an important stake in the...

Words: 1106 - Pages: 5

Free Essay

Akashmsd

...Introduction to the C Programming Language Science & Technology Support High Performance Computing Ohio Supercomputer Center 1224 Kinnear Road Columbus, OH 43212-1163 Table of Contents • • • • • • • • • Introduction C Program Structure Variables, Expressions, & Operators Input and Output Program Looping Decision Making Statements Array Variables Strings Math Library Functions • • • • • • • • • User-defined Functions Formatted Input and Output Pointers Structures Unions File Input and Output Dynamic Memory Allocation Command Line Arguments Operator Precedence Table 2 C Programming Introduction • Why Learn C? 3 C Programming Why Learn C? • • • • • • • • • Compact, fast, and powerful “Mid-level” Language Standard for program development (wide acceptance) It is everywhere! (portable) Supports modular programming style Useful for all applications C is the native language of UNIX Easy to interface with system devices/assembly routines C is terse 4 C Programming C Program Structure • • • • • Canonical First Program Header Files Names in C Comments Symbolic Constants 5 C Programming Canonical First Program • The following program is written in the C programming language: #include main() { /* My first program */ printf("Hello World! \n"); } • • C is case sensitive. All commands in C must be lowercase. C has a free-form line structure. End of each...

Words: 4639 - Pages: 19

Premium Essay

Practical Verification & Safeguard Tools for C/C++

...P ra c t i c a l ve ri f i c a t i o n & s a fe g u a rd tools for C/C++ F Michaud . R. Carbone DRDC Valcartier Defence R&D Canada – Valcartier Technical Report DRDC Valcartier TR 2006-735 November 2007 Practical verification & safeguard tools for C/C++ F. Michaud R. Carbone DRDC Valcartier DRDC Valcartier Technical Report DRDC Valcartier TR 2006-735 November 2007 Principal Author Approved by Yves van Chestein Head/IKM Approved for release by Christian Carrier Chief Scientist c Her Majesty the Queen in Right of Canada as represented by the Minister of National Defence, 2007 c Sa Majest´ la Reine (en droit du Canada), telle que repr´sent´e par le ministre de la e e e D´fense nationale, 2007 e Abstract This document is the final report of an activity that took place in 2005-2006. The goal of this project was first to identify common software defects related to the use of the C and C++ programming languages. Errors and vulnerabilities created by these defects were also investigated, so that meaningful test cases could be created for the evaluation of best-ofbreed automatic verification tools. Finally, when relevant, best practices were inferred from our experiments with these tools. ´ ´ Resume Ce document est le rapport final d’un projet de recherche qui a eu lieu en 2005-2006. Le but de ce projet ´tait avant tout d’identifier les d´fauts logiciels courants li´s ` l’utilisation des e e e a langages de programmation C et C++. Les erreurs et......

Words: 22394 - Pages: 90