***************OUTPUT*************************** Enter the two number The addition of two number is =100
|
|
- Scott Walters
- 5 years ago
- Views:
Transcription
1 /* 1. Program to calculate the addition of two number using function */ int n1,n2,result; printf(" Enter the two number \n"); scanf("%d%d",&n1,&n2); result=addnum(n1,n2); printf(" The addition of two number is =%d ",result); /* Function declaration */ int addnum(a,b) int a,b; int sum; sum=a+b; return(sum); Enter the two number The addition of two number is =100
2 /* 2. Program to calculate the division of two number using function */ int n1,n2,result; printf(" Enter the two number \n"); scanf("%d%d",&n1,&n2); result=divnum(n1,n2); printf(" The division of two number is =%d ",result); /* Function declaration */ int divnum(a,b) int a,b; int div; div=a/b; return(div); Enter the two number The division of two number is =50
3 /* 3. Program to calculate the multiplication of two number using function */ int n1,n2,result; printf(" Enter the two number \n"); scanf("%d%d",&n1,&n2); result=mulnum(n1,n2); printf(" The multiplication of two number is =%d ",result); /* Function declaration */ int mulnum(a,b) int a,b; int mul; mul=a*b; return(mul); Enter the two number The multiplication of two number is =144
4 /* 4. Program to find the GCD & LCM of two number using function*/ int n1,n2,lcm,gcd; printf(" Enter the two integer numbers\n"); scanf("%d%d",&n1,&n2); gcd=gcd1(n1,n2); lcm=(n1*n2)/gcd; printf(" The GCD number is %d \n",gcd); printf("the LCM number is =%d \n ",lcm); /*function declaration */ int gcd1(int a, int b) int num,den,rem; if(a>=b) num=a; den=b; else num=b; den=a; rem=num%den; while(rem!=0) num=den; den=rem; rem=num%den; return(den);
5 Enter the two integer numbers The GCD number is 5 The LCM number is =100
6 /* 5. Program to find the given year is leap or not using function */ int year; printf(" Enter the year\n"); scanf("%d",&year); leapyear(year); leapyear(int year) if(year%4==0) printf("the given year %d is a leap year ",year); else printf("the given year %d is not a leap year",year); Enter the year 2004 The given year 2004 is a leap year Enter the year 2010 The given year 2010 is not a leap year
7 /* 6. Program to find the factorial of given numbers using Recursive function*/ int n,f; printf("enter the number \n"); scanf("%d",&n); f=fact(n); printf("the factorial is = %d \n ",f); int fact(x) int x; int f; if(x= =0) return(1); else f=x*fact(x-1); return(f); Enter the number 4 The factorial is = 24 Enter the number 0 The factorial is = 1
8 /* 7. Program to sort an array using function */ #include<conio.h> int i; static int marks[5]=35,20,60,10,90; printf(" Marks before sorting \n"); for(i=0;i<5;i++) printf("%4d",marks[i]); printf("\n"); sort(5,marks); printf("marks after sorting \n"); for(i=0;i<5;i++) printf("%4d",marks[i]); sort(m,x) int m,x[]; int i,j,t; for(i=1;i<=m;i++) for(j=1;j<=m;j++) if(x[j-1]>=x[j]) t=x[j-1]; x[j-1]=x[j]; x[j]=t; Marks before sorting Marks after sorting
9 /* 8. Program to illustrate passing of the entire array as an argument*/ #include<conio.h> int i, a[6]; printf("enter array element \n"); for(i=0;i<5;i++) scanf("%d",&a[i]); arraypass(a); int i; arraypass(int a1[]) printf("the entered array element is \n"); for(i=0;i<5;i++) printf("%d\n",a1[i]); Enter array element The entered array element is
10 /* 9.Program to illustrate the comparision of two variable using structure */ struct class int n; char name[10]; float marks; ; int x; struct class student1=1,"preeti",78.9; struct class student2=2,"anand",74.33; struct class student3; student3=student2; x=(student3.n==student2.n)&&(student3.marks == student2.marks)?1:0; if(x==1) printf("\n student2 & student3 are same \n"); printf("rollno\tnmae\tmarks\n"); printf("%d\t%s\t%f\t",student3.n,student3.name,student3.marks); else printf("\n student2 & student 3 are different \n"); printf("rollno\tnmae\tmarks\n"); printf("%d\t%s\t%f\t",student1.n,student1.name,student1.marks); student2 & student3 are same Rollno Nmae Marks 2 Anand
11 /* 10. Program to find the average marks of student obtained in Three subject using structure */ struct stdent int rollno,m1,m2,m3; char name[20]; float avg; st[20]; int i,total,n; printf("enter the no of student information \n"); scanf("%d",&n); printf("enter %d students information \n",n); for(i=0;i<n;i++) printf("student %ds information is ",i+1); printf("\n \n"); printf("rollno:="); scanf("%d",&st[i].rollno); printf("name:="); scanf("%s",&st[i].name); printf("subject1 marks :="); scanf("%d",&st[i].m1); printf("subject2 marks:"); scanf("%d",&st[i].m2); printf("subject3 marks:="); scanf("%d",&st[i].m3); printf("****************************************************** **\n"); printf("rollno\tname\tmarks1\tmarks2\tmarks3\ttotal\taverage\n"); printf("****************************************************** **\n"); for(i=0;i<n;i++)
12 total=st[i].m1+st[i].m2+st[i].m3; st[i].avg=total/3; printf("%d\t%s\t%d\t%d\t%d\t%d\t%f\n",st[i].rollno,st[i].name,st[i].m1,st[i].m2,st[i].m, total,st[i].avg); printf("****************************************************** *\n"); Enter the no of student information 2 Enter 2 students information Student 1s information is Rollno:=1 Name:=Preeti Subject1 marks :=90 Subject2 marks:90 Subject3 marks:=90 Student 2s information is Rollno:=2 Name:=Anand Subject1 marks :=90 Subject2 marks:90 Subject3 marks:=90 ******************************************************** Rollno Name Marks1 Marks2 Marks3 Total Average ******************************************************** 1 Preeti Anand *******************************************************
13 /* 11. Program to illustrate Union */ union number int n1; float n2; ; union number x; printf("enter the value of n1 \n"); scanf("%d",&x.n1); printf("enter the value of n2 \n"); scanf("%f",&x.n2); printf("\n n1=%d",x.n1); printf("\n n2=%f",x.n2); Enter the value of n1 40 Enter the value of n2 70 n1=0 n2=
14 /* 12. Program to swap two number using pointer */ int n1,n2; printf("enter the two number \n"); scanf("%d%d", &n1,&n2); printf("before swap n1=%d and n2=%d \n",n1,n2); swap(&n1,&n2); printf("after the swap n1=%d and n2=%d \n",n1,n2); int swap(int *k1,int *k2) int t; t=*k1; *k1=*k2; *k2=t; Enter the two number Before swap n1=60 and n2=100 After the swap n1=100 and n2=60
15 /* 13.Program to Access a varible using pointer */ int x,y; int *ptr; x=10; ptr=&x; y=*ptr; printf(" The value of x is %d \n\n",x); printf("%d is stored at address %u \n",x,&x); printf("%d is stored at address %u \n",*&x,&x); printf("%d is stored address %u \n ",*ptr,ptr); printf("%d is stored at address %u \n",y,*&ptr); printf("%d is stored at address %u \n ", y,&y); The value of x is is stored at address is stored at address is stored address is stored at address is stored at address 65492
16 /* 14. Program to illustrate a Macro substitution */ #define PI float area; int r; printf("enter the radius \n"); scanf("%d",&r); area= r*r*pi; printf(" Area of circle is %f \n",area); Enter the radius 2 Area of circle is
17 /* 15. Program to find the largest of three numbers using Macro */ #define large(x,y)((x>y)?x:y) int a,b,c,lar; printf(" Enter the three number \n"); scanf("%d%d%d",&a,&b,&c); lar=large(a,large(b,c)); printf(" The largest values is %d",lar); Enter the three number The largest values is 70
18 /* 16.Program illustrate the macros with arguments */ #define sqr(x) (x*x) float p,sqr1; printf(" Enter the value of p\n"); scanf("%f",&p); sqr1=sqr(p); printf(" square number is =%2.0f\n", sqr1); Enter the value of p 12 Square number is =144 Enter the value of p 16 Square number is =256
19 /* 17. Program to find the largest of two number using function */ int a,b; printf("enter the two numbers \n"); scanf("%d%d",&a,&b); large(a,b); /* function to compute the largest */ large( x,y) int x,y; if(x>y) printf("tthe largest value is %d\n",x); else printf("the largest value is %d\n",y); Enter the two numbers The largest value is 80 Enter the two numbers The largest value is 100
20 /* 18.Program to determines whether it is an alphabet,a digit or a special symbol */ char ch,ct; char char_is(); printf("enter a character \n"); ch=getchar(); ct=char_is(ch); if(ct=='a') printf("it is a alphabet \n "); else if(ct=='d') printf("it is a digit \n"); else if(ct=='x') printf("it is a special symbol \n"); char char_is(cyar) char cyar; if((cyar>='a'&& cyar<='z') (cyar>='a' && cyar<='z')) return('a'); else if(cyar>='0'&& cyar<='9') return('d'); else return('x'); Enter a character r It is a alphabet Enter a character 9 It is a digit Enter a character * It is a special symbol
21 /* 19. Program to compute the area of triangle */ #include<math.h> float s1,s2,s3,area; float tri_area(); printf("enter the thre sides of a triangle \n"); scanf("%f%f%f",&s1,&s2,&s3); area=tri_area(s1,s2,s3); printf("the area of the triangle =%f\n",area); float tri_area(a,b,c) float a,b,c; float s,area; s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); return(area); Enter the thre sides of a triangle The area of the triangle =
22 /* 20. Program writing to and reading from a file */ FILE *f1; char c; printf("data input \n"); f1=fopen("input","w"); while((c=getchar())!=eof) putc(c,f1); fclose(f1); printf("data output \n"); f1=fopen("input","r"); while((c=getc(f1))!=eof) printf("%c",c); fclose(f1); Data input This is file handling program ^Z Data output This is file handling program
23 INDEX C PROGRAMS SLNO NAME OF THE PROGRAM 1 Program to calculate the addition of two number using function 2 Program to calculate the division of two number using function 3 Program to calculate the multiplication of two number using function 4 Program to find the GCD & LCM of two number using function 5 Program to find the given year is leap or not using function 6 Program to find the factorial of given numbers using Recursive function PAGE NO REMARKS 7 Program to sort an array using function 8 Program to illustrate passing of the entire array as an argument 9 program to illustrate the comparison of two variable using structure 10 Program to find the average marks of student obtained in three subject using structure 11 Program to illustrate Union 12 Program to swap two number using pointer 13 Program to Access a variable using pointer 14 Program to illustrate a Macro substitution 15 Program to find the largest of three numbers using Macro 16 Program illustrate the macros with arguments 17 Program to find the largest of two number using function 18 Program to determines whether it is an alphabet digit or a special symbol 19 Program to compute the area of triangle 20 Program writing to and reading from a file
24
PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE
PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,
More informationSRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I
SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I Year & Sem: I B.E (CSE) & II Date of Exam: 21/02/2015 Subject Code & Name: CS6202 & Programming & Data
More informationUnit III Functions. C functions can be classified into two categories, namely, library functions and user defined functions.
Unit III Functions Functions: Function Definition, Function prototype, types of User Defined Functions, Function calling mechanisms, Built-in string handling and character handling functions, recursion,
More informationSUMMER 13 EXAMINATION Model Answer
Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate
More information/* Area and circumference of a circle */ /*celsius to fahrenheit*/
/* Area and circumference of a circle */ #include #include #define pi 3.14 int radius; float area, circum; printf("\nenter radius of the circle : "); scanf("%d",&radius); area = pi
More informationME 172. C Programming Language Sessional Lecture 8
ME 172 C Programming Language Sessional Lecture 8 Functions Functions are passages of code that have been given a name. C functions can be classified into two categories Library functions User-defined
More informationint Return the number of characters in string s.
1a.String handling functions: Function strcmp(const char *s1, const char *s2) strcpy(char *s1, const char *s2) strlen(const char *) strcat(char *s1, Data type returned int Task Compare two strings lexicographically.
More information1) Write a C Program to check whether given year is Leap year or not. AIM: A C Program to check whether given year is Leap year or not.
1) Write a C Program to check whether given year is Leap year or not. AIM: A C Program to check whether given year is Leap year or not. #include int year; printf("enter a year:"); scanf("%d",&year);
More information4(a) ADDITION OF TWO NUMBERS. Program:
4(a) ADDITION OF TWO NUMBERS int a,b,c: printf( enter the elements a and b ); scanf( %d%d,&a,&b); c=a+b; printf( sum of the elements is%d,c); Output: Enter the elements a and b: 4 5 Sum of the elements
More information'C' Programming Language
F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax
More informationScheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C
Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.
More informationUNIT 3 FUNCTIONS AND ARRAYS
UNIT 3 FUNCTIONS AND ARRAYS Functions Function definitions and Prototypes Calling Functions Accessing functions Passing arguments to a function - Storage Classes Scope rules Arrays Defining an array processing
More informationBranching is deciding what actions to take and Looping is deciding how many times to take a certain action.
3.0 Control Statements in C Statements The statements of a C program control the flow of program execution. A statement is a command given to the computer that instructs the computer to take a specific
More informationUnit 3 Functions. 1 What is user defined function? Explain with example. Define the syntax of function in C.
1 What is user defined function? Explain with example. Define the syntax of function in C. A function is a block of code that performs a specific task. The functions which are created by programmer are
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationFUNCTIONS. Without return With return Without return With return. Example: function with arguments and with return value
FUNCTIONS Definition: A is a set of instructions under a name that carries out a specific task, assigned to it. CLASSIFICATION of s: 1. User defined s (UDF) 2. Library s USER DEFINED FUNCTIONS Without
More informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities
PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities Continuous Internal Evaluation Test 2 Date: 0-10- 2017 Marks: 0 Subject &
More informationSubject: Fundamental of Computer Programming 2068
Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find
More informationWAP 10. WAP 11. WAP 12. WAP 13. WAP 14. WAP 15. WAP 16. WAP 1. : 17. WAP 18. WAP 19. WAP 20. WAP 21. WAP 22. WAP 23. WAP & 24. WAP
Contents 1. WAP to accept the value from the user and exchange the values.... 2 2. WAP to check whether the number is even or odd.... 2 3. WAP to Check Odd or Even Using Conditional Operator... 3 4. WAP
More informationMA 511: Computer Programming Lecture 2: Partha Sarathi Mandal
MA 511: Computer Programming Lecture 2: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Largest
More informationUEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter
UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter What you will learn from Lab 7 In this laboratory, you will understand how to use typical function prototype with
More informationCS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0) Introduction to arrays
CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0) Introduction to arrays 1 What are Arrays? Arrays are our first example of structured data. Think of a book with pages numbered 1,2,...,400.
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)
Subject Code: 17212 Model Answer Page No: 1/28 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model
More informationP.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS)
FACULTY: Ms. Saritha P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) SUBJECT / CODE: Programming in C and Data Structures- 15PCD13 What is token?
More informationx 2 +7x+1 x<0 7x+17 0<x 10 Z= x 2 +10x x 25 25x+100 other values
IF STATEMENT 2013-2014 General form of an if without an : If (a Boolean expression) A sequence of statement General form of an if with an : If (a Boolean expression) A sequence of statements a sequence
More information// CSE/CE/IT 124 JULY 2015, 2.a. algorithm to inverse the digits of a given integer. Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0
// CSE/CE/IT 124 JULY 2015, 2a algorithm to inverse the digits of a given integer Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0 Step 4: repeat until NUMBER > 0 r=number%10; rev=rev*10+r; NUMBER=NUMBER/10;
More informationVOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS
VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS 1. Write C++ programs to interchange the values of two variables. a. Using with third variable int n1, n2, temp; cout
More informationCOP 3223 Introduction to Programming with C - Study Union - Spring 2018
COP 3223 Introduction to Programming with C - Study Union - Spring 2018 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationPractice problems Set 2
Practice problems Set 2 1) Write a program to obtain transpose of a 4 x 4 matrix. The transpose of matrix is obtained by exchanging the elements of each row with the elements of the corresponding column.
More informationSri vidya college of engineering and technology UNIT II FUNCTIONS, POINTERS, STRUCTURES AND UNIONS
UNIT II FUNCTIONS, POINTERS, STRUCTURES AND UNIONS FUNCTIONS AND POINTERS Functions are created when the same process or an algorithm to be repeated several times in various places in the program. Function
More informationTest Paper 3 Programming Language Solution Question 1: Briefly describe the structure of a C program. A C program consists of (i) functions and (ii) statements There should be at least one function called
More informationUNDERSTANDING THE COMPUTER S MEMORY
POINTERS UNDERSTANDING THE COMPUTER S MEMORY Every computer has a primary memory. All our data and programs need to be placed in the primary memory for execution. The primary memory or RAM (Random Access
More informationProgramming Language B
Programming Language B Takako Nemoto (JAIST) 3 December Takako Nemoto (JAIST) 3 December 1 / 18 Today s topics 1 Function-like macro 2 Sorting 3 Enumeration 4 Recursive definition of functions 5 Input/output
More informationBCSE1002: Computer Programming and Problem Solving LAB MANUAL
LABMANUAL BCSE1002: Computer Programming and Problem Solving LAB MANUAL L T P Course Type Semester Offered Academic Year 2018-2019 Slot Class Room Faculty Details: Name Website link Designation School
More informationPESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities
SOLUTION OF CONTINUOUS INTERNAL EVALUATION TEST -1 Date : 27-02 2018 Marks:60 Subject & Code : Programming in C and Data Structures- 17PCD23 Name of faculty : Dr. J Surya Prasad/Mr. Naushad Basha Saudagar
More information1. Basics 1. Write a program to add any two-given integer. Algorithm Code 2. Write a program to calculate the volume of a given sphere Formula Code
1. Basics 1. Write a program to add any two-given integer. Algorithm - 1. Start 2. Prompt user for two integer values 3. Accept the two values a & b 4. Calculate c = a + b 5. Display c 6. Stop int a, b,
More informationMODULE 2: Branching and Looping
MODULE 2: Branching and Looping I. Statements in C are of following types: 1. Simple statements: Statements that ends with semicolon 2. Compound statements: are also called as block. Statements written
More informationHuawei Test 2. 1 Two dice are thrown simultaneously. What is the probability of getting two numbers whose product is even?
Huawei Test 2 1 Two dice are thrown simultaneously. What is the probability of getting two numbers whose product is even? ( )1/ 2 ( )3/4 ( )3/8 ( )5/16 Explanation: In a simultaneous throw of two dice,
More informationLecture 4. 1 Statements: 2 Getting Started with C++: LESSON FOUR
1 Statements: A statement in a computer carries out some action. There are three types of statements used in C++; they are expression statement, compound statement and control statement. Expression statement
More informationProgramming & Data Structure Laboratory. Day 2, July 24, 2014
Programming & Data Structure Laboratory Day 2, July 24, 2014 Loops Pre and post test loops for while do-while switch-case Pre-test loop and post-test loop Condition checking True Loop Body False Loop Body
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate
More informationCS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0)
CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0) Class Teacher: Pralay Mitra Department of Computer Science and Engineering Indian Institute of Technology Kharagpur An Example: Random
More informationTest Paper 1 Programming Language 1(a) What is a variable and value of a variable? A variable is an identifier and declared in a program which hold a value defined by its type e.g. integer, character etc.
More informationFunctions. Autumn Semester 2009 Programming and Data Structure 1. Courtsey: University of Pittsburgh-CSD-Khalifa
Functions Autumn Semester 2009 Programming and Data Structure 1 Courtsey: University of Pittsburgh-CSD-Khalifa Introduction Function A self-contained program segment that carries out some specific, well-defined
More informationQ 1. Attempt any TEN of the following:
Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The
More informationA. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS
Syllabus: Pointers and Preprocessors: Pointers and address, pointers and functions (call by reference) arguments, pointers and arrays, address arithmetic, character pointer and functions, pointers to pointer,initialization
More informationLearning C Language. For BEGINNERS. Remember! Practice will make you perfect!!! :D. The 6 th week / May 24 th, Su-Jin Oh
Remember! Practice will make you perfect!!! :D Learning C Language For BEGINNERS The 6 th week / May 24 th, 26 Su-Jin Oh sujinohkor@gmail.com 1 Index Basics Operator Precedence Table and ASCII Code Table
More informationStructure, Union. Ashishprajapati29.wordpress.com. 1 What is structure? How to declare a Structure? Explain with Example
Structure, Union 1 What is structure? How to declare a Structure? Explain with Example Structure s a collection of logically related data items of different data types grouped together under a single name.
More informationUNIT - V STRUCTURES AND UNIONS
UNIT - V STRUCTURES AND UNIONS STRUCTURE DEFINITION A structure definition creates a format that may be used to declare structure variables. Let us use an example to illustrate the process of structure
More informationAryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9
Fundamental of C Programming Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Q2. Write down the C statement to calculate percentage where three subjects English, hindi, maths
More informationIV Unit Second Part STRUCTURES
STRUCTURES IV Unit Second Part Structure is a very useful derived data type supported in c that allows grouping one or more variables of different data types with a single name. The general syntax of structure
More informationChapter 4 Functions By C.K. Liang
1 Chapter 4 Functions By C.K. Liang What you should learn? 2 To construct programs modularly from small pieces called functions Math functions in C standard library Create new functions Pass information
More informationF.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C
F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1 (a) List any four relational operators.
More informationP.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES EVEN SEMESTER FEB 2017
P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) EVEN SEMESTER FEB 07 FACULTY: Dr.J Surya Prasad/Ms. Saritha/Mr.
More informationDepartment of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #06
Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Practice Sheet #06 Topic: Recursion in C 1. What string does the following program print? #include #include
More informationProgramming in C Lab
Programming in C Lab 1a. Write a program to find biggest number among given 3 numbers. ALGORITHM Step 1 : Start Start 2 : Input a, b, c Start 3 : if a > b goto step 4, otherwise goto step 5 Start 4 : if
More informationDarshan Institute of Engineering & Technology for Diploma Studies Unit 5
1 What is structure? How to declare a Structure? Explain with Example Structure is a collection of logically related data items of different data types grouped together under a single name. Structure is
More informationPointers and Structure. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island
Pointers and Structure Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island 1 Pointer Variables Each variable in a C program occupies space in
More informationQuestion Bank (SPA SEM II)
Question Bank (SPA SEM II) 1. Storage classes in C (Refer notes Page No 52) 2. Difference between function declaration and function definition (This question is solved in the note book). But solution is
More informationPROGRAMMING IN C AND C++:
PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print
More informationStructured programming
Exercises 2 Version 1.0, 22 September, 2016 Table of Contents 1. Simple C program structure................................................... 1 2. C Functions..................................................................
More informationC PROGRAMMING LAB MANUAL
C PROGRAMMING LAB MANUAL For BEX/BCT/B.Sc.CSIT/BIM/BCA BY BABU RAM DAWADI RAM DATTA BHATTA 448/ From the Book: Capsules of C Programming Appendix - B C PROGRAMMING LAB SHEETS Dear Students, Welcome to
More informationLesson 5: Functions and Libraries. EE3490E: Programming S1 2018/2019 Dr. Đào Trung Kiên Hanoi Univ. of Science and Technology
Lesson 5: Functions and Libraries 1 Functions 2 Overview Function is a block of statements which performs a specific task, and can be called by others Each function has a name (not identical to any other),
More informationFor Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit
For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/ For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/
More informationExample: Structure, Union. Syntax. of Structure: struct book { char title[100]; char author[50] ]; float price; }; void main( )
Computer Programming and Utilization ( CPU) 110003 Structure, Union 1 What is structure? How to declare a Structure? Explain with Example Structure is a collection of logically related data items of different
More informationUnit 8. Structures and Unions. School of Science and Technology INTRODUCTION
INTRODUCTION Structures and Unions Unit 8 In the previous unit 7 we have studied about C functions and their declarations, definitions, initializations. Also we have learned importance of local and global
More informationTEST BDA24202 / BTI10202 COMPUTER PROGRAMMING May 2013
DEPARTMENT OF MATERIAL AND ENGINEERING DESIGN FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING UNIVERSITI TUN HUSSEIN ONN MALAYSIA (UTHM), JOHOR TEST BDA24202 / BTI10202 COMPUTER PROGRAMMING May 2013
More informationVidyalankar F.Y. Diploma : Sem. II [CD/CM/CO/CW/DE/ED/EE/EI/EJ/EN/EP/ET/EV/EX/IC/IE/IF/IS/IU/MU] Programming in C
F.Y. Diploma : Sem. II [CD/CM/CO/CW/DE/ED/EE/EI/EJ/EN/EP/ET/EV/EX/IC/IE/IF/IS/IU/MU] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 100 Q.1 Attempt any TEN of the following : [20]
More informationPreview from Notesale.co.uk Page 4 of 63
1. Write a program to compute area of a circle after reading input from user. #include #include int float area, radius, pi=3.141; printf("enter the radius of circle \t"); scanf("%f",
More informationComputer Programming for Engineering Applica4ons. Intro to Programming 10/2/13 ECE 175. Limita4ons of Reference by Value. The Concept of Pointers
Computer Programming for Engineering Applica4ons ECE 175 Intro to Programming Limita4ons of Reference by Value Write a C func4on that does the following Argument: the radius of a circle r Output: circumference
More information& Technology. G) Functions. void. Argument2, Example: (Argument1, Syllabus for 1. 1 What. has a unique. 2) Function name. passed to.
Computer Programming and Utilization (CPU) 110003 G) Functions 1 What is user defined function? Explain with example. Define the syntax of function in C. A function is a block of code that performs a specific
More informationUNIT-IV. Structure is a user-defined data type in C language which allows us to combine data of different types together.
UNIT-IV Unit 4 Command Argument line They are parameters/arguments supplied to the program when it is invoked. They are used to control program from outside instead of hard coding those values inside the
More informationM3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE
M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be
More informationDepartment of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #07. Topic: Pointer in C Date:
Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Practice Sheet #07 Topic: Pointer in C Date: 23-02-2017 1. Assume the following C variable declaration int *A [10],
More informationCSE202-Lec#4. CSE202 C++ Programming
CSE202-Lec#4 Functions and input/output streams @LPU CSE202 C++ Programming Outline Creating User Defined Functions Functions With Default Arguments Inline Functions @LPU CSE202 C++ Programming What is
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER
Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate
More informationFunctions. Prof. Indranil Sen Gupta. Dept. of Computer Science & Engg. Indian Institute t of Technology Kharagpur. Introduction
Functions Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute t of Technology Kharagpur Programming and Data Structure 1 Function Introduction A self-contained program segment that
More informationFUNCTIONS OMPAL SINGH
FUNCTIONS 1 INTRODUCTION C enables its programmers to break up a program into segments commonly known as functions, each of which can be written more or less independently of the others. Every function
More informationProgramming Language A
Programming Language A Takako Nemoto (JAIST) 22 October Takako Nemoto (JAIST) 22 October 1 / 28 From Homework 2 Homework 2 1 Write a program calculate something with at least two integer-valued inputs,
More informationFunctions. Functions are everywhere in C. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR
1 Functions Functions are everywhere in C Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Introduction Function A self-contained program segment that carries
More informationUnit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array?
1 What is an array? Explain with Example. What are the advantages of using an array? An array is a fixed-size sequenced collection of elements of the same data type. An array is derived data type. The
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Midterm Examination October 20, 2011 6:15 p.m. 8:00 p.m. (105 minutes) Examiners: J. Anderson, T. Fairgrieve,
More informationExample: Pointer Basics
Example: Pointer Basics #include int (void) { float a1, a2; /* Simple variables */ float *p1, *p2, *w; /* Pointers to variables of type float */ a1 = 10.0, a2 = 20.0; printf("after a1 = 10.0;
More informationSearching Elements in an Array: Linear and Binary Search. Spring Semester 2007 Programming and Data Structure 1
Searching Elements in an Array: Linear and Binary Search Spring Semester 2007 Programming and Data Structure 1 Searching Check if a given element (called key) occurs in the array. Example: array of student
More informationQuestions Bank. 14) State any four advantages of using flow-chart
Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State
More informationIntroduction to C Language (M3-R )
Introduction to C Language (M3-R4-01-18) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in OMR answer sheet supplied with the question paper, following
More informationb. array s first element address c. base address of an array d. all elements of an array e. both b and c 9. An array elements are always stored in a.
UNIT IV 1. Appropriately comment on the following declaration int a[20]; a. Array declaration b. array initialization c. pointer array declaration d. integer array of size 20 2. Appropriately comment on
More informationName :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70
Name :. Roll No. :..... Invigilator s Signature :.. 2011 INTRODUCTION TO PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give
More informationVARIABLE, OPERATOR AND EXPRESSION [SET 1]
VARIABLE, OPERATOR AND EXPRESSION Question 1 Write a program to print HELLO WORLD on screen. Write a program to display the following output using a single cout statement. Subject Marks Mathematics 90
More information1.1 Basic Concepts 1
1.1 Basic Concepts 1 What is Data Structure? (1) Data Structure How do we store (input/output) data in a (mostly) main memory? Ex) How to store a Matrix in a memory? We need to specify a data structure
More informationProgramming in C Lab
Lab Manual for Programming in C Lab 2139 Diploma In Computer Engineering 2 nd Semester By SITTTR Kalamassery STATE INSTITUTE OF TECHNICAL TEACHERS TRAINING AND RESEARCH 2 GENERAL INSTRUCTIONS Rough record
More information2.2 Pointers. Department of CSE
2.2 Pointers 1 Department of CSE Objectives To understand the need and application of pointers To learn how to declare a pointer and how it is represented in memory To learn the relation between arrays
More informationFunction. specific, well-defined task. whenever it is called or invoked. A function to add two numbers A function to find the largest of n numbers
Functions 1 Function n A program segment that carries out some specific, well-defined task n Example A function to add two numbers A function to find the largest of n numbers n A function will carry out
More informationWhat is recursion. WAP to find sum of n natural numbers using recursion (5)
DEC 2014 Q1 a What is recursion. WAP to find sum of n natural numbers using recursion (5) Recursion is a phenomenon in which a function calls itself. A function which calls itself is called recursive function.
More informationAnswer for I/O Operation Exercise:
Answer for I/O Operation Exercise: 1) Write a program to input the rainfall of three consecutive days in CMS and find its average. float a,b,c,avg; printf("enter the rainfalls of three days in Cms:");
More informationModule 6: Array in C
1 Table of Content 1. Introduction 2. Basics of array 3. Types of Array 4. Declaring Arrays 5. Initializing an array 6. Processing an array 7. Summary Learning objectives 1. To understand the concept of
More informationET156 Introduction to C Programming
ET156 Introduction to C Programming Unit 1 INTRODUCTION TO C PROGRAMMING: THE C COMPILER, VARIABLES, MEMORY, INPUT, AND OUTPUT Instructor : Stan Kong Email : skong@itt tech.edutech.edu Figure 1.3 Components
More informationINDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator
INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator EXAMINATION ( Mid Semester ) SEMESTER ( Autumn ) Roll Number Section Name Subject Number C S Subject Name Programming and Data
More informationSHARDAYATAN -E.M STD-10 C-PROGRAMS
PROGRAM -1 //PROGRAM TO DISPLAY YOUR SCHOOL NAME, ADDRESS int main() printf("\n ***************************"); printf("\n * SHARDAYATAN SCHOOL *"); printf("\n * OPP. LAKEVIEW GARDEN, *"); printf("\n *
More information