Skip to main content

Posts

Showing posts from May, 2011

spring 11 mgt101 gdb solution

Mr. A and Mr. B are partners sharing the profits in the ratio of 2 & 3. Mr. C is admitted into the partnership with 1/5th share of future profits. Calculate the new profit sharing ratio and the sacrifice ratio. solution: ____________ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mr. A=2 Mr. B=3 Mr. C=1/5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; New Profit ratio of Mr. A , Mr.B and  Mr.C is  8:12:4 and ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; and Sacrifice ratio of Mr.A, Mr.B and Mr.C is 0.08, 0.52, 0.04 its !100% share by jani

Data types

So far we have looked at local variable now we switch our attension to other types of variables supported by the C programming language:    1.Global Variables    2.Constant Data Types

Global Variables

   1.Global Variables   Global variables: Variables can be declared as either local variables which can be used inside the function it has been declared in (more on this in further sections) and global variables which are known throughout the entire program. Global variables are created by declaring them outside any function. For example:  int max;  main()   {     .....   }  f1()   {     .....   } The int max can be used in both main and function f1 and any changes made to it will remain consistent for both functions.The understanding of this will become clearer when you have studied the section on functions but I felt I couldn't complete a section on data types without mentioning global and local variables.  

Constant Data type

1.Constant Data Types:                    Constants refer to fixed values that may not be altered by the program. All the data types we have previously covered can be defined as constant data types if we so wish to do so. The constant data types must be defined before the main function. The format is as follows: #define CONSTANTNAME value for example: #define SALESTAX 0.05 The constant name is normally written in capitals and does not have a semi-colon at the end. The use of constants is mainly for making your programs easier to be understood and modified by others and yourself in the future. An example program now follows: #define SALESTAX 0.05 #include <stdio.h> main()  {    float amount, taxes, total;    printf("Enter the amount purchased : ");    scanf("%f",&amount);    taxes = SALESTAX*amount;    printf("The sal...

Unix systems

Unix systems: The University's central irix Service is a Silicon Graphics Inc. Challenge XL system which runs a Unix-like operating sysem called IRIX. The basic information to run a C program on this system is covered in document HT.SI.05 - How To... Run C Programs On The irix Service. Although this document refers to the IRIX operating system many of the command options will be common to all Unix systems. On all Unix systems further help on the C compiler can be obtained from the on-line manual. Type man cc on your local Unix system for more information. Please note that Unix is a case sensitive operating system and files named firstprog.c and FIRSTPROG.c are treated as two separate files on these system. By default the Unix system compiles and links a program in one step, as follows: cc firstprog.c This command creates an executable file called a.out that overwrites any existing file called a.out. Executable files on Unix are run by typing their name. In this case the p...

Using Microsoft C

Edit stage:      Type program in using one of the Microsoft Windows editing packages. Compile and link :      Select Building from Make menu. Building option allows you to both compile and link in the same option. Execute:      Use the Run menu and select Go option. Errors:      First error highlighted. Use Next Error from Search menu for further errors if applicable. If you get an error message, or you find that the program doesn't work when you finally run it (at least not in the way you anticipated) you will have to go back to the source file - the .c file - to make changes and go through the whole development process again!  

Executable files

Thus the text editor produces .c source files, which go to the compiler, which produces .obj object files, which go to the linker, which produces .exe executable file. You can then run .exe files as you can other applications, simply by typing their names at the DOS prompt or run using windows menu.

Linking

The first question that comes to most peoples minds is Why is linking necessary? The main reason is that many compiled languages come with library rountines which can be added to your program. Theses routines are written by the manufacturer of the compiler to perform a variety of tasks, from input/output to complicated mathematical functions. In the case of C the standard input and output functions are contained in a library (stdio.h) so even the most basic program will require a lib rary function. After linking the file extension is .exe which are executable files.  

Compiling

                       You cannot directly execute the source file. To run on any computer system, the source file must be translated into binary numbers understandable to the computer's Central Procesing Unit (for example, the 80*87 microprocessor). This process produces an intermediate object file - with the extension .obj, the .obj stands for Object.

Editing

                 You write a computer program with words and symbols that are understandable to human beings. This is the edit part of the development cycle. You type the program directly into a window on the screen and save the resulting text as a separate file. This is often referred to as the source file (you can read it with the TYPE command in DOS or the cat command in unix). The custom is that the text of a C program is stored in a f ile with the extension .c for C programming language  

C for Personal Computers

C for Personal Computers: With regards to personal computers Microsoft C for IBM (or clones) PC's. and Borlands C are seen to be the two most commonly used systems. However, the latest version of Microsoft C is now considered to be the most powerful and efficient C compiler for personal computers.

A Brief History of C

A Brief History of C: C is a general-purpose language which has been closely associated with the UNIX operating system for which it was developed - since the system and most of the programs that run it are written in C. Many of the important ideas of C stem from the language BCPL, developed by Martin Richards. The influence of BCPL on C proceeded indirectly through the language B, which was written by Ken Thompson in 1970 at Bell Labs, for the first UNIX system on a DEC PDP-7. BCPL and B are "typeless" languages whereas C provides a variety of data types. In 1972 Dennis Ritchie at Bell Labs writes C and in 1978 the publication of The C Programming Language by Kernighan & Ritchie caused a revolution in the computing world. In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or "ANSI C", was completed late 1988. A Rough Guide to ...

Uses of C

Uses of C C was initially used for system development work, in particular the programs that make-up the operating system. Why use C? Mainly because it produces code that runs nearly as fast as code written in assembly language. Some examples of the use of C might be:      Operating Systems      Language Compilers      Assemblers      Text Editors      Print Spoolers      Network Drivers      Modern Programs      Data Bases      Language Interpreters      Utilities In recent years C has been used as a general-purpose language because of its popularity with programmers. It is not the world's easiest language to learn and you will certainly benifit if you are not learning C as your first programming language! C is trendy (I nearly said sexy) - many well established programmers ar...

Why use C?

Why use C? C has been used successfully for every type of programming problem imaginable from operating systems to spreadsheets to expert systems - and efficient compilers are available for machines ranging in power from the Apple Macintosh to the Cray supercomputers. The largest measure of C's success seems to be based on purely practical considerations:      the portability of the compiler;      the standard library concept;      a powerful and varied repertoire of operators;      an elegant syntax;      ready access to the hardware when needed;      and the ease with which applications can be optimized by hand-coding isolated procedures C is often called a " Middle Level" programming language . This is not a reflection on its lack of programming power but more a reflection on its capability to access the system's low level functions. Most high-level langua...

Objectives

Objectives: This section is designed to give you a general overview of the C programming language. Although much of this section will be expanded in later sections it gives you a taste of what is to come.  

Legend & Vendor

Rank – Position within the TOP500 ranking. In the TOP500 List table, the computers are ordered first by their Rmax value. In the case of equal performances (Rmax value) for different computers, the order is by Rpeak. For sites that have the same computer, the order is by memory size and then alphabetically. Rmax – The highest score measured using the LINPACK benchmark suite. This is the number that is used to rank the computers. Measured in trillions of floating point operations per second , i.e. teraflops . Rpeak – This is the theoretical peak performance of the system. Measured in Tflops. Name – Some supercomputers are unique, at least on its location, and are therefore christened by its owner. Computer – The computing platform as it is marketed. Processor cores – The number of active processor cores actively used running Linpack. After this figure is the processor architecture of the cores named. If the interconnect between computing nodes is of interest, it's a...

Top 10 positions of the 36th TOP500 List released on November 14, 2010 during SC10 in New Orleans, LA

In November 2010 Rank Rmax Rpeak ( Tflops ) Name Computer Processor cores Vendor Site Country, Year Operating System 1 2566.00 4701.00 Tianhe-1A NUDT YH Cluster 14,336x6 Xeon + 7168×14 Fermi , Arch (Proprietary) [ 8 ] NUDT National Supercomputing Center of Tianjin     China , 2010 Linux 2 1759.00 2331.00 Jaguar Cray XT5 224,162 Opteron Cray Oak Ridge National Laboratory     United States , 2009 Linux ( CLE ) 3 1271.00 2984.30 Nebulae Dawning TC3600 Blade 55,680 Xeon + 64,960 Tesla , InfiniBand Dawning National Supercomputing Center in Shenzhen (NSCS)     China , 2010 Linux 4 1192.00 2287.63 TSUBAME 2.0 HP Cluster Platform 3000SL 73,278 Xeon , Fermi NEC / HP GSIC Center, Tokyo Institute of Technology     Japan , 2010 Linux ( SLES 11) 5 1054.00 1288.63 Hopper Cray XE6 153,408 Opteron Cray DOE/SC/LBNL/NERSC     United States , 2010 Linux ( CLE ) 6 1050.00 1254.55 Tera 100 Bull Bullx 138,368 Xeon , Inf...

Most powerful computer systems in the world.

500 most powerful known computer systems in the world. Comparison (November 2010) [ 4 ] [ 5 ] [ 6 ] Country Top speed (Rmax) ( Tflops ) Number of computers in TOP500   China 2566 41   United States 1759 274   Japan 1192 26   France 1050 26   Germany 826 26   Russia 350 11   South Korea 316 3   United Kingdom 275 25   India 220 4

The systems ranked #1 since 1993

Country Top speed (Rmax) ( Tflops ) Number of computers in TOP500   China 2566 41   United States 1759 274   Japan 1192 26   France 1050 26   Germany 826 26   Russia 350 11   South Korea 316 3   United Kingdom 275 25   India 220 4 The systems ranked #1 since 1993 NUDT Tianhe-1A (   China , since November 2010) Cray Jaguar (   United States , November 2009 - November 2010) IBM Roadrunner (   United States , June 2008 – November 2009) IBM Blue Gene /L (   United States , November 2004 – June 2008) NEC Earth Simulator (   Japan , June 2002 – November 2004) IBM ASCI White (   United States , November 2000 – June 2002) Intel ASCI Red (   United States , June 1997 – November 2000) Hitachi CP-PACS (   Japan , November 1996 – June 1997) Hitachi SR2201 (   Japan , June 1996 – November 1996) Fujitsu Numerical Wind Tunnel (   Japan , November 1994 – June 1996) Intel Par...