Free Essay

String Reversal Program C

In:

Submitted By asim81
Words 366
Pages 2
Course Title
Fundamentals of Algorithm

* Write a function which take two integer constants and display the sum, multiplication. If both numbers are less than 100 otherwise if first number is less than 100 and second number is greater than 100 then perform the division. Please note that sum, multiplication and division logic should be in separate function.

#include<stdio.h>
#include<conio.h>

int a,b,x,y;

int sumIt(int x , int y ) { return x + y;
}

int multiplyIt(int x, int y) { return x * y;
}

int devideIt(int x, int y) { return y / x;
}

void displayIt(int a, int b) {

if (a < 100 && b < 100)
{
printf("sum is %d",sumIt(a,b)); printf("\nproduct is %d",multiplyIt(a,b));
} else if (a < 100 && b > 100)
{
printf("Devision is %d",devideIt(a,b));
} else
{
printf("No condition matches so not performing any 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;
}

Similar Documents

Free Essay

Technical

...1. What does static variable mean? When a variable is declared to static it will be initialized the default value zero. It is local to the block in which it is declared. The lifetime persists for each and every function call. 2. What is a pointer? A pointer is also called a reference of a particular data type. But instead of storing some value it stores the address of a particular variable. This address can be initialized by using “&” operator. Eg: int a = &b; 3. What is a structure? Structure is a special type of user defined data structure which comprises of a collection of certain type predefined data types like int, char, float etc. It is an entity which comprises of many atoms. 4. What are differences between structure and array? Arrays are group of data of same data type, whereas structure is combination of entities of different data types. Size of array needs to be declared initially itself whereas structure can be done both initially and dynamically. 5. In header files whether functions are declared or defined? Inside header files the functions are defined and they are not declared. This is also a type of structure definition. 6. What are the differences between malloc() and calloc()? malloc() takes a single argument(memory required in bytes), while calloc() needs 2 arguments(number of variables to allocate memory, size in bytes of a single variable). Secondly, malloc() doesnot initialize the memory allocated, while calloc() initializes the allocated memory...

Words: 3226 - Pages: 13

Free Essay

Java Array

...variables, such as number0, number1, ..., and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. This tutorial introduces how to declare array variables, create arrays, and process arrays using indexed variables. Declaring Array Variables: To use an array in a program, you must declare a variable to reference the array, and you must specify the type of array the variable can reference. Here is the syntax for declaring an array variable: ------------------------------------------------- dataType[] arrayRefVar; // preferred way. ------------------------------------------------- ------------------------------------------------- or ------------------------------------------------- ------------------------------------------------- dataType arrayRefVar[]; // works but not preferred way. Note: The style dataType[] arrayRefVar is preferred. The style dataType arrayRefVar[] comes from the C/C++ language and was adopted in Java to accommodate C/C++ programmers. Example: The following code snippets are examples of this syntax: ------------------------------------------------- double[] myList; // preferred way. ------------------------------------------------- ------------------------------------------------- or ------------------------------------------------- ...

Words: 1665 - Pages: 7

Premium Essay

Magnetic Swipe Card System Security

...Park Daniel Ramsbrock dramsbro@umd.edu Stepan Moskovchenko stevenm86@gmail.com Christopher Conroy cconroy@gmail.com Abstract This paper provides a comprehensive security analysis of the Lenel magnetic swipe card system used at the University of Maryland at College Park. We first explore the cards and hardware components which comprise the system, and then present several plausible points and methods of attack on the system. We chose several of these attacks and demonstrated them using a $240 commercial card reader/writer and a customized unit powered by a microcontroller, which cost about $20 in parts. We developed the capability to read cards, write arbitrary data to cards, simulate card swipes through a reader using a flux reversal pattern generator, and “sniff” data from up to 16 live swipes using a single microcontroller which can be easily hidden in the reader's housing. We tested and successfully demonstrated these capabilities on the live Lenel system under the supervision of the university's Department of Public Safety. Based on our findings, we recommend that the university use neither social security nor university ID numbers on the cards, that it use magnetic card access only in low-security areas, and that it use a more sophisticated and secure system such as proximity smart cards for access to high-security areas. While the analysis and recommendations presented in this paper are aimed at the University of Maryland, building security professionals everywhere...

Words: 11974 - Pages: 48

Free Essay

Testing

...(FIS) SPRF#400019173 Reversal Correction - HLD [pic] Version 1.7 Version Created on 6/01/2009 Table of Contents 1. Revision History 4 2. Overview 5 2.1 Purpose 5 2.2 Scope 5 2.2.1 In Scope 5 2.2.2 Out of Scope 5 2.3 Assumptions 6 2.4 Reference 7 2.5 Functional Description – Reversal-Correction Process 8 2.5.1 Functional Overview 8 2.5.1.1 Current State Data Flow Diagrams 8 2.5.1.2 Future State Data Flow Diagrams 12 2.6 Related Application Requirements 19 2.7 Key Considerations 20 2.8 Source System Inputs 21 2.9 FDS/ODS Inputs 21 2.10 FDS/ODS Outputs 22 2.11 Logical Data Model Diagram – N/A 22 2.11.1 Table Definitions 22 2.12 Technical Description 25 2.13 Processing Logic 25 2.13.1 Functional Process Flow 25 2.13.2 Process 01 – Identification 29 2.13.2.1 Inputs 29 2.13.2.2 Outputs 29 2.13.2.3 Potential temporary/staging table definition 30 2.13.2.4 Processing Steps 31 2.13.2.5 Mapping document 31 2.13.3 Process 02 – Reversal 32 2.13.3.1 Inputs 32 2.13.3.2 Outputs 32 2.13.3.3 Potential temporary/staging table definition 34 2.13.3.4 Processing Steps 34 2.13.3.5 Mapping document 35 2.13.4 Process 03 – Delete 35 2.13.4.1 Inputs 35 2.13.4.2 Outputs 36 2.13.4.3 Potential temporary/staging table definition 37 2.13.4.4 Processing Steps 37 2.13.4.5 Mapping document 37 2.13...

Words: 9695 - Pages: 39

Premium Essay

Computers

...C Primer Plus Sixth Edition Developer’s Library ESSENTIAL REFERENCES FOR PROGRAMMING PROFESSIONALS Developer’s Library books are designed to provide practicing programmers with unique, high-quality references and tutorials on the programming languages and technologies they use in their daily work. All books in the Developer’s Library are written by expert technology practitioners who are especially skilled at organizing and presenting information in a way that’s useful for other programmers. Key titles include some of the best, most widely acclaimed books within their topic areas: PHP & MySQL Web Development Luke Welling & Laura Thomson ISBN 978-0-672-32916-6 Python Essential Reference David Beazley ISBN-13: 978-0-672-32978-4 MySQL Paul DuBois ISBN-13: 978-0-321-83387-7 PostgreSQL Korry Douglas ISBN-13: 978-0-672-32756-8 Linux Kernel Development Robert Love ISBN-13: 978-0-672-32946-3 C++ Primer Plus Stephen Prata ISBN-13: 978-0-321-77640-2 Developer’s Library books are available in print and in electronic formats at most retail and online bookstores, as well as by subscription from Safari Books Online at safari. informit.com Developer’s Library informit.com/devlibrary C Primer Plus Sixth Edition Stephen Prata Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Cape Town • Sydney • Tokyo • Singapore • Mexico City C Primer Plus Sixth...

Words: 125302 - Pages: 502

Free Essay

C++ Chap1-8 Quiz Summary

... | c. Operators  | | | d. Program ops  | | | e. None of the above  | | Correct Marks for this submission: 1/1. Question2 Marks: 1 Programmer-defined names of memory locations that may hold data are: Choose one answer. | a. Operators  | | | b. Variables  | | | c. Syntax  | | | d. Operands  | | | e. None of the above.  | | Correct Marks for this submission: 1/1. Question3 Marks: 1 Which of the following best describes an operator? Choose one answer. | a. An operator is a rule that must be followed when constructing a program.  | | | b. An operator allows you to perform operations on one or more pieces of data.  | | | c. An operator marks the beginning or ending of a statement, or is used to separate items in a list.  | | | d. An operator is a word that has a special meaning.  | | | e. An operator is a symbolic name that refers to a variable.  | | Correct Marks for this submission: 1/1. Question4 Marks: 1 What does the term hardware refer to? Choose one answer. | a. The relative difficulty of programming  | | | b. The physical components that a computer is made of  | | | c. The way a computer's storage space is organized  | | | d. The logical flow of instructions  | | | e. None of the above.  | | Correct Marks for this submission: 1/1. Question5 Marks: 1 The computer's main memory is commonly known as: Choose one answer. | a. The hard disk  | | | b. The floppy disk  | | | c. RAM ...

Words: 10107 - Pages: 41

Free Essay

Lol Girl

...written permission of Charles E. Cook. Manufactured in the United States of America. Preface You will find this book to be somewhat unusual. Most computer science texts will begin with a section on the history of computers and then with a flurry of definitions that are just “so many words” to the average student. My approach with Blue Pelican Java is to first give the student some experience upon which to hang the definitions that come later, and consequently, make them more meaningful. This book does have a history section in Appendix S and plenty of definitions later when the student is ready for them. If you will look at Lesson 1, you will see that we go right to work and write a program the very first day. The student will not understand several things about that first program, yet he can immediately make the computer do something useful. This work ethic is typical of the remainder of the book. Rest assured that full understanding comes in time. Abraham Lincoln himself subscribed to this philosophy when he said, “Stop petting the mule, and load the wagon.” The usual practice in most Java textbooks of introducing classes and objects alongside the fundamental concepts of primitive variable types, loops, decision structures, etc. is deferred until the student has a firm grasp of the fundamentals. Thus, the...

Words: 31284 - Pages: 126

Free Essay

Hacking the Art of Exploitation

...2nd Edition Hacking the art of exploitation jon erickson PRAISE FOR THE FIRST EDITION OF HACKING: THE ART OF EXPLOITATION “Most complete tutorial on hacking techniques. Finally a book that does not just show how to use the exploits but how to develop them.” —PHRACK “From all the books I’ve read so far, I would consider this the seminal hackers handbook.” —SECURITY FORUMS “I recommend this book for the programming section alone.” —UNIX REVIEW “I highly recommend this book. It is written by someone who knows of what he speaks, with usable code, tools and examples.” —IEEE CIPHER “Erickson’s book, a compact and no-nonsense guide for novice hackers, is filled with real code and hacking techniques and explanations of how they work.” —COMPUTER POWER USER (CPU) MAGAZINE “This is an excellent book. Those who are ready to move on to [the next level] should pick this book up and read it thoroughly.” —ABOUT.COM INTERNET/NETWORK SECURITY ® San Francisco HACKING: THE ART OF EXPLOITATION, 2ND EDITION. Copyright © 2008 by Jon Erickson. All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. Printed on recycled paper in the United States of America 11 10 09 08 07 123456789 ISBN-10: 1-59327-144-1 ISBN-13: 978-1-59327-144-2 Publisher:...

Words: 139438 - Pages: 558

Free Essay

Good

...ORGANIZATIONAL DEVELOPMENT AND BEHAVIORAL FACTORS Mgmt 605-M02 Mondays 6:00-8:10 p.m. DESCRIPTION This course links the classical management process to the analysis of human behavior. How do people think, analyze a situation, and how they behave. The practicing manager should gain theoretical knowledge on which to base experience and/or intuition when making decisions or solving problems involving the human dimension in the organization. In this course you are going to learn a series of models: 1) The individual—to help you understand, predict, and modify an individual’s behavior. 2) Perception of people—how such perception differs from other perceptions aspects and its importance 3) Functions of the managerial brain—how it works, makes decisions, solves problems, creates ideas 3) Dimensions of communications—to enable you to understand the basics of transmittal of knowledge 2) Two person interactions—so that you can understand conflict, leadership behavior, negotiations. 3) Small group functions,--so that you can understand when and why they are strong and get results and when they are weak and become failures 4) The large organization—so that you can utilize their strengths in marshalling human resources to get the work out and how they can adapt to changing times. If you have any problems with this course, doing the work or meeting standards, speak to your instructor before you receive failing grades or other unpleasant consequences. When you discuss...

Words: 22795 - Pages: 92

Premium Essay

Study Guide

...® OCA Oracle Database 11g: SQL Fundamentals I Exam Guide (Exam 1Z0-051) ABOUT THE AUTHORS John Watson (Oxford, UK) works for BPLC Management Consultants, teaching and consulting throughout Europe and Africa. He was with Oracle University for several years in South Africa, and before that worked for a number of companies, government departments, and NGOs in England and Europe. He is OCP qualified in both database and Application Server administration. John is the author of several books and numerous articles on technology and has 25 years of experience in IT. Roopesh Ramklass (South Africa), OCP, is an independent Oracle specialist with over 10 years of experience in a wide variety of IT environments. These include software design and development, systems analysis, courseware development, and lecturing. He has worked for Oracle Support and taught at Oracle University in South Africa for several years. Roopesh is experienced in managing and executing IT development projects, including infrastructure systems provisioning, software development, and systems integration. About the Technical Editor Bruce Swart (South Africa) works for 2Cana Solutions and has over 14 years of experience in IT. Whilst maintaining a keen interest for teaching others, he has performed several roles including developer, analyst, team leader, administrator, project manager, consultant, and lecturer. He is OCP qualified in both database and developer roles. He has taught at Oracle University...

Words: 150089 - Pages: 601

Free Essay

Parallel

...licensed use limited to: UNIVERSITY OF VICTORIA. Downloaded on July 29,2010 at 20:21:17 UTC from IEEE Xplore. Restrictions apply. Recognized as an American National Standard (ANSI) IEEE Std 1284-1994 IEEE Standard Signaling Method for a Bidirectional Parallel Peripheral Interface for Personal Computers Sponsor Microprocessor and Microcomputer Standards Committee of the IEEE Computer Society Approved March 30, 1994 IEEE Standards Board Approved September 2, 1994 American National Standards Institute Abstract: A signaling method for asynchronous, fully interlocked, bidirectional parallel communications between hosts and printers or other peripherals is defined. A format for a peripheral identification string and a method of returning this string to the host outside of the bidirectionaldata stream is also specified. Keywords: bidirectional parallel communications, computers, interfaces, PCs, personal computers, printers The Institute of Electrical and Electronics Engineers, Inc. 345 East 47th Street, New York, NY 10017-2394, USA Copyright 0 1994 by the Institute of Electrical and Electronics Engineers, Inc. All rights reserved. Published 1994. Printed in the United States of America. ISBN...

Words: 34986 - Pages: 140

Premium Essay

Globalization

...GLOBALIZATION: BOON OR BANE INTRODUCTION Globalisation can be defined as the growing economic interdependence of countries worldwide through the increasing volume and variety of cross-border transactions in goods and services and of international capital flows through the rapid and widespread diffusion of technology. The fact that is important in today’s globalisation that really matters is that the accelerating speed is very fast. In the past it takes years or decades for influence to be passed for such an impact to be made. But today the influences or transmission of culture values, language, economy and administration can take place within months. This is the major difference. So globalisation is the transmission or extension of values, goods, services, thought or culture across border and it occurs with accelerated rate. The drivers for this accelerated speed are the technology and economic liberalism and the free movement of people. The nature of capitalism was such that entrepreneurial talent would not be constrained by geographical and legal boundaries. The growth of a dynamic trade system and the consequent development of classical payment arrangements like the gold standard have been seen by political economists as early yet decisive pointers towards the globalisation of the world economy. At the centre of this process is the idea of the Market and in particular the market for finance, capital, allied with the Multinational Corporation...

Words: 8031 - Pages: 33

Free Essay

Asdf

...waves and apply basic wave principles towards an understanding of music. The Elements of Communication Communication: transfer of information from a source or stimulus through a medium to a reception point. The medium through which the information travels can be air, water, space or solid objects. Information that is carried through all natural media takes the form of waves - repeating patterns that oscillate back and forth. E.g. light, sound, electricity radio and TV waves. Stimulus: A medium must be stimulated in order for waves of information to be generated in it. A stimulus produces energy, which radiates outwards from the source in all directions. The sun and an electric light bulb produce light energy. A speaker, a vibrating guitar string or tuning fork and the voice are sound sources, which produce sound energy waves. Medium: A medium is something intermediate or in the middle. In an exchange of communication the medium lies between the stimulus and the receptor. The medium transmits the waves generated by the stimulus and delivers these waves...

Words: 15258 - Pages: 62

Free Essay

Paper

...Making Everythin ™ heory tring T S Learn: • The basic concepts of this controversial theory • How string theory builds on physics concepts • The different viewpoints in the field • String theory’s physical implications Andrew Zimmerman Jones Physics Guide, About.com with Daniel Robbins, PhD in Physics Get More and Do More at Dummies.com® Start with FREE Cheat Sheets Cheat Sheets include • Checklists • Charts • Common Instructions • And Other Good Stuff! To access the Cheat Sheet created specifically for this book, go to www.dummies.com/cheatsheet/stringtheory Get Smart at Dummies.com Dummies.com makes your life easier with 1,000s of answers on everything from removing wallpaper to using the latest version of Windows. Check out our • Videos • Illustrated Articles • Step-by-Step Instructions Plus, each month you can win valuable prizes by entering our Dummies.com sweepstakes. * Want a weekly dose of Dummies? Sign up for Newsletters on • Digital Photography • Microsoft Windows & Office • Personal Finance & Investing • Health & Wellness • Computing, iPods & Cell Phones • eBay • Internet • Food, Home & Garden Find out “HOW” at Dummies.com *Sweepstakes not currently available in all countries; visit Dummies.com for official rules. String Theory FOR DUMmIES ‰ by Andrew Zimmerman Jones with Daniel Robbins, PhD in Physics String Theory For Dummies® Published by Wiley Publishing, Inc. 111 River St. Hoboken, NJ 07030-5774 www.wiley.com...

Words: 133965 - Pages: 536

Premium Essay

The Late 1990 Financial Crisis in Ecuador

...WP/04/12 The Late 1990s Financial Crisis in Ecuador: Institutional Weaknesses, Fiscal Rigidities, and Financial Dollarization at Work Luis I. Jacome H. © 2004 International Monetary Fund WP/04/12 IMF Working Paper Monetary and Financial Systems Department The Late 1990s Financial Crisis in Ecuador: Institutional Weaknesses, Fiscal Rigidities, and Financial Dollarization at Work Prepared by Luis I. Jácome H.1 Authorized for distribution by Mark Swinburne January 2004 Abstract This Working Paper should not be reported as representing the views of the IMF. The views expressed in this Working Paper are those of the author(s) and do not necessarily represent those of the IMF or IMF policy. Working Papers describe research in progress by the author(s) and are published to elicit comments and to further debate. This paper stresses three factors that amplified the 1990s financial crisis in Ecuador, namely institutional weaknesses, rigidities in public finances, and high financial dollarization. Institutional factors restricted the government’s ability to respond in a timely manner and efficiently enough to prevent the escalation of the banking crisis and spurred the adoption of suboptimal policy decisions. Public finance rigidities limited the government’s capacity to correct existing imbalances and the deteriorating fiscal stance associated with the costs of the financial crisis. Financial dollarization increasingly reduced the effectiveness of financial ...

Words: 19607 - Pages: 79