Ex. No. 3 C PROGRAMMING
|
|
- Edward Summers
- 5 years ago
- Views:
Transcription
1 Ex. No. 3 C PROGRAMMING C is a powerful, portable and elegantly structured programming language. It combines features of a high-level language with the elements of an assembler and therefore, suitable for writing both system software and application packages. It is the most widely used generalpurpose language today. C has been used for implementing systems such as operating systems, compilers, linkers, word processors and utility packages. It is a robust language whose rich set of built-in functions and operators can be used to write any complex program. Programs written in C are fast and efficient. Turbo C IDE Turbo C IDE facilitates editing, debugging and execution of applications written in C. C programs are saved with.c extension. Some of the shortcut keys are: Ctrl + F1 F2 F3 Copy Cut Paste Clear Help Save Open Ctrl + Ins Shift + Del Shift + Ins Ctrl + Del Alt + F9 Ctrl + F9 Alt + F5 F7 Alt + F3 Alt + X Compile Execute User Screen Trace Into Close Quit
2 Ex. No. 3.1 AREA OF A CIRCLE Aim Algorithm To write a program to compute the area and circumference of a circle. Step 1 : Step 2 : Define constant pi = 3.14 Step 3 : Read the value of radius Step 4 : Calculate area using formulae pi*radius 2 Step 5 : Step 6 : Step 7 : Calculate circumference using formulae 2*pi*radius Print area and circumference Stop Flowchart pi = 3.14 Read radius area = pi * radius 2 circumference = 2 * pi * radius Print area, circumference Stop
3 Program /* Area and circumference of a circle */ #include <stdio.h> #include <conio.h> #define pi 3.14 main() int radius; float area, circum; clrscr(); printf("\nenter radius of the circle : "); scanf("%d",&radius); area = pi * radius * radius; circum = 2 * pi * radius; printf("\narea is %.2f and circumference is %.2f\n",area,circum); getch(); Output Enter radius of the circle : 8 Area is and circumference is 50.24
4 Ex. No. 3.2 BIGGEST OF TWO NUMBERS Aim Algorithm To write a program to determine the bigger of two numbers using ternary operator. Step 1 : Step 2 : Step 3 : Read values of a and b If a = b then print "Both are equal" Step 3.1 : Else if a > b then print "A is big" Step 3.2 : Else print "B is big" Step 4 : Stop Flowchart Read a, b a=b? Y Print "Both are equal" N Print "B is big" N a>b? Y Print "A is big" Stop
5 Program /* Biggest of 2 Nos using Ternary Operator */ #include <stdio.h> #include <conio.h> main() int a,b; clrscr(); printf("enter A value : "); scanf("%d",&a); printf("enter B value : "); scanf("%d",&b); (a==b)? printf("\nboth are equal") : a>b? printf("\na is greater") : printf("\nb is greater"); getch(); Output Enter A value : -2 Enter B value : -5 A is greater Enter A value : 4 Enter B value : 7 B is greater Enter A value : 11 Enter B value : 11 Both are equal
6 Ex. No. 3.3 LEAP YEAR Aim Algorithm To write a program to check whether the given year is a leap year. Step 1 : Step 2 : Step 3 : Read the value of year If year divisible by 400 then print "Leap year" Step 3.1 : Else if year divisible by 4 and not divisible by 100 then print "Leap year" Step 3.2 : Step 4 : Else print "Not a leap year" Stop Flowchart Read year year%400=0? N Y Print "Leap" Print "Not Leap" N year%4 = 0 and year%100 0? Y Print "Leap" Stop
7 Program /* Leap Year */ #include <stdio.h> #include <conio.h> main() int year; clrscr(); printf("\nenter the year : "); scanf("%d",&year); if (year%400 == 0) printf("\n%d is a Leap year",year); else if (year%100!= 0 && year%4 == 0) printf("\n%d is a Leap year",year); else printf("\n%d is not a Leap year",year); getch(); Output Enter the year : is a Leap year Enter the year : is not a Leap year Enter the year : is a Leap year
8 Ex. No. 3.4 SIMPLE CALCULATOR Aim Algorithm To write a menu driven calculator program using switch statement. Step 1 : Step 2 : Step 3 : Step 4 : Display calculator menu options Read the operator symbol and operands n1, n2 If operator = + then calculate result = n1 + n2 Step 4.1 : Else if operator = then calculate result = n1 n2 Step 4.2 : Else if operator = * then calculate result = n1 * n2 Step 4.3 : Else if operator = / then calculate result = n1 / n2 Step 4.4 : Else if operator = % then calculate result = n1 % n2 Step 4.2 : Else print "Invalid operator" and go to step 6 Step 5 : Step 6 : Print result Stop
9 Flowchart Display Calculator menu Read operator, n1, n2 operator? + * / % res=n1+n2 res=n1 n2 res=n1*n2 res=n1/n2 res=n1%n2 Other Print res Operator" Print "Invalid operator" Stop
10 Program /* Simple Calculator */ #include <stdio.h> #include <stdlib.h> #include <conio.h> main() int n1, n2, result; char op; clrscr(); printf("\n Simple Calculator\n"); printf("\n + Summation"); printf("\n - Difference"); printf("\n * Product"); printf("\n / Quotient"); printf("\n % Remainder\n"); printf("\nenter the operator : "); op = getchar(); printf("enter operand1 and operand2 : "); scanf("%d%d",&n1,&n2); switch (op) case '+': result = n1 +n2; break; case '-': result = n1 - n2; break; case '*': result = n1 * n2; break; case '/': result = n1 / n2; break; case '%': result = n1 % n2; break; default: printf("invalid operator"); exit(-1); printf("\n%d %c %d = %d", n1, op, n2, result); getch();
11 Output Simple Calculator + Summation - Difference * Product / Quotient % Remainder Enter the operator : - Enter operand1 and operand2 : = -2 Simple Calculator + Summation - Difference * Product / Quotient % Remainder Enter the operator : * Enter operand1 and operand2 : * 2 = 6 Simple Calculator + Summation - Difference * Product / Quotient % Remainder Enter the operator : % Enter operand1 and operand2 : % 2 = 1
12 Ex. No. 3.5 BINARY TO DECIMAL Aim loop. To write a program to convert binary number to its decimal equivalent using while Algorithm Step 1 : Step 2 : Read the binary value Step 3 : Initialize dec and i to 0 Repeat steps 4 7 until binary > 0 Step 4 : Extract the last digit using modulo 10 Step 5 : Calculate decimal = decimal + digit * 2 i Step 6 : Recompute binary = binary / 10 Step 7 : Increment i by 1 Step 8 : Step 9 : Print decimal Stop
13 Flowchart Read binary decimal = i = 0 binary>0? N Y digit = binary % 10 decimal = decimal + digit * 2 i binary = binary / 10 i = i + 1 Print decimal Stop
14 Program /* Binary to Decimal */ #include <stdio.h> #include <math.h> #include <conio.h> main() int dec=0,i=0, d; long bin; clrscr(); printf("enter a binary number : "); scanf("%ld",&bin); while(bin) d = bin % 10; dec = dec + pow(2,i) * d; bin = bin/10; i = i + 1; printf("\ndecimal Equivalent is %d", dec); getch(); Output Enter a binary number : Decimal Equivalent is 107
15 Ex. No. 3.6 PRIME NUMBER Aim Algorithm To write a program to check the given number is prime or not using for loop. Step 1 : Step 2 : Read the value of n Step 3 : Initialize i to 2 and flg to 0 Repeat steps 4 and 5 until i n/2 Step 4 : If n is divisible by i then assign 1 to flg and go to Step 6 Step 5 : Increment i by 1 Step 6 : If flg = 0 then print "Prime" Step 6.1 : Else print "Not prime" Step 7 : Stop
16 Flowchart Read n i = 2, flg = 0 i n/2? N Y n%i = 0? Y flg = 1 N i = i + 1 Print "Not Prime" N flg = 0? Y Print "Prime" Stop
17 Program /* Prime number */ #include <stdio.h> #include <conio.h> main() int i,n,flg=0; clrscr(); printf("\nenter a number : "); scanf("%d",&n); for(i=2; i<=n/2; i++) if (n%i == 0) flg = 1; break; if (flg == 0) printf("\nthe given number is prime"); else printf("\nthe given number is not prime"); getch(); Output Enter a number : 27 The given number is not prime Enter a number : 43 The given number is prime
18 Ex. No. 3.7 ARRAY MINIMUM / MAXIMUM Aim Algorithm To write a program to find the largest and smallest of an array Step 1 : Step 2 : Step 3 : Step 4 : Read the number of array elements as n Set up a loop and read array elements A i, i = 0,1,2, n 1 Assume the first element A 0 to be min and max Step 5 : Initialize i to 1 Repeat steps 6 8 until i < n Step 6 : Step 7 : If max < A i then max = A i If min > A i then min = A i Step 8 : Increment i by 1 Step 9 : Print max, min Step 10 : Stop
19 Flowchart Read n i = 0 to n 1 Read A i i min = max = A 0 i = 1 to n 1 max < A i? N Y max = A i min > A i? N Y min = A i i Print min, max Stop
20 Program /* Maximum and Minimum of an array */ #include <stdio.h> #include <conio.h> main() int a[10]; int i,min,max,n; clrscr(); printf("enter number of elements : "); scanf("%d",&n); printf("\nenter Array Elements\n"); for(i=0; i<n; i++) scanf("%d",&a[i]); min = max = a[0]; for(i=1; i<n; i++) if (max < a[i]) max = a[i]; if (min > a[i]) min = a[i]; printf("\nmaximum value = %d \n Minimum value = %d",max,min); getch(); Output Enter number of elements : 6 Enter Array Elements Maximum value = 11 Minimum value = -9
21 Ex. No. 3.8 MATRIX MULTIPLICATION Aim Algorithm To write a program to perform matrix multiplication based on their dimensions. Step 1 : Step 2 : Step 3 : Step 4 : Read the order of matrix A as m and n Read the order of matrix B as p and q If n p then print "Multiplication not possible" and Stop Step 5 : Set up a loop and read matrix A elements A ij, i = 0 to m-1 and j = 0 to n-1 Step 6: Set up a loop and read matrix B elements B ij, i = 0 to p-1 and j = 0 to q-1 Step 7 : Step 8 : Step 9 : Initialize i to zero Initialize j to zero Assign 0 to C ij Step 10 : Initialize k to zero Step 11 : Compute C ij = C ij + A ik * B kj Step 12 : Increment k by 1 Repeat steps 11 and 12 until k < n Step 13 : Increment j by 1 Repeat steps 9 13 until j < q Step 14 : Increment i by 1 Repeat steps 8 14 until i < m Step 15 : Set up a loop and print product matrix C ij, i = 0 to m-1 and j = 0 to q-1 Step 16 : Stop
22 Flow Chart Read m, n Read p, q Y n=p? i = 0 to m 1 N Print min, max X j = 0 to n 1 Read A ij j i i = 0 to p 1 j = 0 to q 1 Read B ij j i 2
23 2 i = 0 to m 1 j = 0 to q 1 C ij = 0 k = 0 to n 1 C ij = C ij + A ik * B kj k j i i = 0 to m 1 j = 0 to q 1 Print C ij j i X Stop
24 Program /* Matrix Multiplication */ #include <stdio.h> #include <conio.h> main() int a[10][10], b[10][10], c[10][10]; int r1, c1, r2, c2; int i, j, k; clrscr(); printf("enter order of matrix A : "); scanf("%d%d", &r1, &c1); printf("enter order of matrix B : "); scanf("%d%d", &r2, &c2); if (c1!= r2) printf("\nmatrix multiplication not possible"); getch(); exit(0); printf("\nenter matrix A elements\n"); for(i=0; i<r1; i++) for(j=0; j<c1; j++) scanf("%d",&a[i][j]); printf("\nenter matrix B elements\n"); for(i=0; i<r2; i++) for(j=0; j<c2; j++) scanf("%d",&b[i][j]); for(i=0; i<r1; i++) for(j=0; j<c2; j++) c[i][j] = 0;
25 for(k=0; k<c1; k++) c[i][j] += a[i][k] * b[k][j]; printf("\nproduct matrix C\n"); for(i=0; i<r1; i++) for(j=0; j<c2; j++) printf("%-4d",c[i][j]); printf("\n"); getch(); Output Enter order of matrix A : 2 3 Enter order of matrix B : 3 2 Enter matrix A elements Enter matrix B elements Product matrix C Enter order of matrix A : 3 3 Enter order of matrix B : 2 3 Matrix multiplication not possible
26 Ex. No. 3.9 ALPHABETICAL ORDER Aim To write a program to arrange names in their alphabetic order using bubble sort method. Algorithm Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : Step 6: Read number of name as n Set up a loop and read the name list in name array Assign 0 to i Assign i+1 to j If name i > name j then swap the strings name i and name j Step 7 : Increment j by 1 Repeat steps 6 and 7 until j < n Step 8 : Increment i by 1 Repeat steps 5 8 until i < n-1 Step 9 : Set up a loop and print the sorted name array Step 10 : Stop
27 Flow Chart Read n i = 0 to n 1 Read name i i i = 0 to n 2 j = i+1 to n 1 name i > name j? N Y Swap strings name i, name j j i i = 0 to n 1 Print name i i Stop
28 Program /* Sorting strings */ #include <stdio.h> #include <conio.h> #include <string.h> main() char name[20][15], t[15], srch[15]; int i,j,n,upper,lower,mid; clrscr(); printf("enter number of students : "); scanf("%d",&n); printf("\nenter student names\n"); for(i=0; i<n; i++) scanf("%s",name[i]); /* Bubble Sort method */ for(i=0; i<n-1; i++) for(j=i+1;j<n;j++) if (strcmp(name[i],name[j]) > 0) strcpy(t, name[i]); strcpy(name[i], name[j]); strcpy(name[j], t); printf("\nalphabetical Order\n"); for(i=0;i<n;i++) printf("%s\n",name[i]); getch();
29 Output Enter number of students : 10 Enter student names Raghu Praba Gopal Anand Venkat Kumar Saravana Naresh Christo Vasanth Alphabetical Order Anand Christo Gopal Kumar Naresh Praba Raghu Saravana Vasanth Venkat
30 Ex. No STRING REVERSE Aim Algorithm To write a program to reverse the given string without using library functions. Step 1 : Step 2 : Step 3 : Read string str Assign 0 to len Step 4 If len th character '\0' then go to step 5 else step 6 Step 5 : Increment len by 1 and go to step 4 Step 6 : Step 7: Assign 0 to i and len-1 to j Swap the i th and j th character Step 8 : Increment i by 1 Step 9 : Decrement j by 1 Repeat steps 7 9 until i < len/2 Step 10 : Print reversed string str Step 10 : Stop
31 Flow Chart Read str len = 0 len th char '\0'? N Y len = len + 1 i = 0 j = len - 1 i < len/2? N Y T = i i = j j = T i = i + 1 j = j 1 Print str Stop
32 Program /* User-defined String reverse */ #include <stdio.h> #include <conio.h> main() char *str; int i,j,len=0; char t; clrscr(); printf("enter a String : "); gets(str); /* String Length */ while (str[len]!= '\0') len++; /* String Reverse */ for(i=0, j=len-1; i<len/2; i++, j--) t = str[i]; str[i] = str[j]; str[j] = t; printf("\nreversed String : %s",str); getch(); Output Enter a String : SMK Fomra Institute of Tech Reversed String : hcet fo etutitsni armof KMS
33 Ex. No SINE SERIES Aim function. To write a program to generate sine series sin(x) = x x x x value using 3! 5! 7! Algorithm Step 1 : Step 2 : Read sine degree as deg Step 3 : Convert degree to radians using the formula x = deg * / 180 Step 4 : Step 5 : Step 6: Call sinecalc function with parameter x Print computed value of sine series Stop sinecalc Function Step 1 : Assign x to term and sum Repeat steps 3 and 4 until term < Step 2 : Step 3 : Step 4 : Compute new term as term = term * x 2 / (2i (2i+1)) Alternatively subtract and add term to sum Return sum
34 Flow Chart Read deg, n x = deg * 3.14 / 180 Call sinevalue = sinecalc(x) Print sinevalue Stop sinecalc (x) sgn = 1 sum = term = x term> N Y sgn = -sgn term = term * x 2 / (2i (2i+1)) sum = sum + sgn * term Return (sum)
35 Program /* Sine series */ #include <stdio.h> #include <math.h> #define pi 3.14 float sinecalc(float, int); main() int deg,n; float x,sineval; clrscr(); printf("enter Sine degree : "); scanf("%d",°); printf("enter no. of terms : "); scanf("%d",&n); x = deg*pi/180; sineval = sinecalc(x); printf("\ngenerated series value : %.4f", sineval); printf("\nbuilt-in function value : %.4f", sin(x)); printf("\ncomputational error\t : %.4f", sin(x)-sineval); getch(); float sinecalc(float x) int i=1,sgn=1; float sum,term; sum = term = x; while (1) if (term < ) break; printf("\nthe term is %.4lf and sum is %.4lf", term, sum); sgn = -sgn; term *= x*x / (2*i * (2*i+1)); sum += sgn *term; i++; return (sum);
36 Output Enter Sine degree: 73 The term is and sum is The term is and sum is The term is and sum is The term is and sum is The term is and sum is The value of Generated Sine series is Value using built-in function is Computational error is
37 Ex. No RECURSIVE FUNCTION Aim To write a program to find factorial value of a given number n! = n * (n-1)! using recursion. Algorithm Step 1 : Step 2 : Step 3 : Step 4 : Step 5: Read the value of n Call factorial function with parameter n Print factorial value Stop factorial Function Step 1 : If n = 1 then return 1 Step 1.1 : Else return n * factorial(n-1)
38 Flow Chart Read n Call factvalue = factorial(n) Print factvalue Stop factorial(n) Y n = 1? N Return (1) Return (n * factorial(n-1))
39 Program /* Factorial--Recursion */ #include <stdio.h> #include <conio.h> long factorial(int); main() int n; long int f; clrscr(); printf("enter a number : "); scanf("%d",&n); f=factorial(n); printf("factorial value : %ld",f); getch(); long factorial(int n) if (n<=1) return(1); else return (n * factorial(n-1)); Output Enter a number : 6 Factorial value : 720 Enter a number : 12 Factorial value :
40 Ex. No PASS BY VALUE & REFERENCE Aim To write a program that demonstrates passing parameters to a function by value and reference. Algorithm Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : Step 6 : Step 7 : Step 8 : Assign 10 to a and 20 to b Print a and b Call swapval function with values of a and b Print a and b Call swapref function with address of a and b Print a and b Stop swapval Function Step 1 : Step 2 : Step 3 : Step 4 : t = a a = b b = t Return Step 1 : t = *a Step 2 : *a = *b swapref Function Step 3 : Step 4 : *b = t Return
41 Flow Chart a = 10 b = 20 Print a, b Call swapval(a, b) Print a, b Call swapref(&a, &b) Print a, b Stop swapval (a, b) swapref (*a, *b) t = a a = b b = t t = *a *a = *b *b = t Return Return
42 Program /* Pass by value and reference */ #include <stdio.h> #include <conio.h> void swapval(int, int); void swapref(int *,int *); main() int a = 10, b = 20; clrscr(); printf("\nvalues before function calls\n"); printf("value of A : %d\n",a); printf("value of B : %d\n",b); swapval(a,b); printf("\nvalues after Pass by Value\n"); printf("value of A : %d\n",a); printf("value of B : %d\n",b); swapref(&a,&b); printf("\nvalues after Pass by Reference\n"); printf("value of A : %d\n",a); printf("value of B : %d",b); getch(); /* Pass by value */ void swapval(int a,int b) int t; t = a; a = b; b = t; /* Pass by Reference*/ void swapref(int *x,int *y) int t; t = *x; *x = *y; *y = t;
43 Output Values before function calls Value of A : 10 Value of B : 20 Values after Pass by Value Value of A : 10 Value of B : 20 Values after Pass by Reference Value of A : 20 Value of B : 10
44 Ex. No PAYROLL APPLICATION Aim Algorithm To write a program to print employee payroll of a concern using structure. Step 1 : Step 2 : Step 3 : Step 4 : Define employee structure with fields empid, ename, basic, hra, da, it, gross and netpay Read number of employees n Set up a loop and read empid, ename, and basic for n employees in emp array Set up a loop and do steps 5 9 for n employees Step 5 : Step 6 : Step 7 : Step 8 : Step 9 : Step 10: Step 11 hra = 2% of basic da = 1% of basic gross = basic + hra + da it = 5% of basic netpay = gross - it Print company and column header Set up a loop and print empid, ename, basic, hra, da, it, gross and netpay for each employee in emp array Step 12 : Stop
45 Flow Chart Define emp structure Read n i = 0 to n-1 Read emp i.empid, emp i.name, emp i.basic i i = 0 to n-1 emp i.hra = 0.02 * emp i.basic emp i.da = 0.01 * emp i.basic emp i.it = 0.05 * emp i.basic emp i.gross = emp i.basic + emp i.hra + emp i.da emp i.netpay = emp i.gross - emp i.it i i = 0 to n-1 Print emp i.empid, emp i.name, emp i.basic, emp i.hra, emp i.da, emp i.gross, emp i.it, emp i.netpay i Stop
46 Program /* Payroll Generation */ #include <stdio.h> #include <conio.h> struct employee int empid; char ename[15]; int basic; float hra; float da; float it; float gross; float netpay; ; main() struct employee emp[50]; int i, j, n; clrscr(); printf("\nenter No. of Employees : "); scanf("%d", &n); for(i=0; i<n ;i++) printf("\nenter Employee Details\n"); printf("enter Employee Id : "); scanf("%d", &emp[i].empid); printf("enter Employee Name : "); scanf("%s", emp[i].ename); printf("enter Basic Salary : "); scanf("%d", &emp[i].basic); for(i=0; i<n; i++) emp[i].hra = 0.02 * emp[i].basic; emp[i].da = 0.01 * emp[i].basic; emp[i].it = 0.05 * emp[i].basic; emp[i].gross = emp[i].basic+emp[i].hra+emp[i].da; emp[i].netpay = emp[i].gross - emp[i].it;
47 printf("\n\n\n\t\t\t\txyz & Co. Payroll\n\n"); for(i=0;i<80;i++) printf("*"); printf("\nempid\tname\t\tbasic\t HRA\t DA\t IT\t Gross\t\tNet Pay\n\n"); for(i=0;i<80;i++) printf("*"); for(i=0; i<n; i++) printf("\n%d\t%-15s\t%d\t%.2f\t%.2f\t%.2f\t %.2f\t%.2f", emp[i].empid, emp[i].ename, emp[i].basic,emp[i].hra,emp[i].da, emp[i].it, emp[i].gross, emp[i].netpay); printf("\n"); for(i=0;i<80;i++) printf("*"); getch(); Output Enter No. of Employees : 2 Enter Employee Details Enter Employee Id : 436 Enter Employee Name : Gopal Enter Basic Salary : Enter Employee Details Enter Employee Id : 463 Enter Employee Name : Rajesh Enter Basic Salary : XYZ & Co. Payroll ******************************************************************************** EmpId Name Basic HRA DA IT Gross Net Pay ******************************************************************************** 436 Gopal Rajesh ********************************************************************************
/* 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 informationGE6161 COMPUTER PRACTICES LABORATORY L T P C
GE6161 COMPUTER PRACTICES LABORATORY L T P C 0 0 3 2 1. Search, generate, manipulate data using MS office/ Open Office 2. Presentation and Visualization graphs, charts, 2D, 3D 3. Problem formulation, Problem
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 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 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 informationLAB MANUAL CS6212- PROGRAMMING AND DATA STRUCTURES LABORATORY I. Dharmapuri Regulation : 2013 Branch : B.E. CSE
Dharmapuri 636 703 LAB MANUAL Regulation : 2013 Branch Year & Semester : B.E. CSE : I Year / II Semester CS6212- PROGRAMMING AND DATA STRUCTURES LABORATORY I ANNA UNIVERSITY CHENNAI REGULATION-2013 CS6212
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 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 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 informationAlgorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm
s 4. Odd or even Step 3 : If number divisible by 2 then Print "Number is Even" Step 3.1 : else Print "Number is Odd" Step 4 : Stop 5. Greatest among three numbers Step 2 : Read values of a, b and c Step
More informationPROGRAMMING 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 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 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 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 information1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms.
PROBLEM: 1. FIBONACCI SERIES Write a C++ program to generate the Fibonacci for n terms. AIM: To write a C++ program to generate the Fibonacci for n terms. PROGRAM CODING: #include #include
More informationArrays. Arrays are of 3 types One dimensional array Two dimensional array Multidimensional array
Arrays Array is a collection of similar data types sharing same name or Array is a collection of related data items. Array is a derived data type. Char, float, int etc are fundamental data types used in
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 informationSubject: Computer Science
Subject: Computer Science Topic: Data Types, Variables & Operators 1 Write a program to print HELLO WORLD on screen. 2 Write a program to display output using a single cout statement. 3 Write a program
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 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 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 informationAMCAT Automata Coding Sample Questions And Answers
1) Find the syntax error in the below code without modifying the logic. #include int main() float x = 1.1; switch (x) case 1: printf( Choice is 1 ); default: printf( Invalid choice ); return
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 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 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 informationSubject: PIC Chapter 2.
02 Decision making 2.1 Decision making and branching if statement (if, if-, -if ladder, nested if-) Switch case statement, break statement. (14M) 2.2 Decision making and looping while, do, do-while statements
More informationWrite a C program using arrays and structure
03 Arrays and Structutes 3.1 Arrays Declaration and initialization of one dimensional, two dimensional and character arrays, accessing array elements. (10M) 3.2 Declaration and initialization of string
More informationMultiple Choice Questions ( 1 mark)
Multiple Choice Questions ( 1 mark) Unit-1 1. is a step by step approach to solve any problem.. a) Process b) Programming Language c) Algorithm d) Compiler 2. The process of walking through a program s
More informationThe Hyderabad Public School, Begumpet, Hyderabad, A.P
The Hyderabad Public School, Begumpet, Hyderabad, A.P. 500 016 2012-13 Department of Computer Science Class 8 Worksheet 3 1) How many times will the following statement execute? ( ) int a=5; while(a>6)
More informationINDORE INDIRA SCHOOL OF CAREER STUDIES C LANGUAGE Class B.Sc. - IIND Sem
UNIT- I ALGORITHM: An algorithm is a finite sequence of instructions, a logic and explicit step-by-step procedure for solving a problem starting from a known beginning. OR A sequential solution of any
More informationComputers Programming Course 6. Iulian Năstac
Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap
More informationCAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE
CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE a) Mention any 4 characteristic of the object car. Ans name, colour, model number, engine state, power b) What
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 information-2017-18 1. a.. b. MS-Paint. Ex.No 1 Windows XP c. 23,, d. MS-Dos DIR /W /P /B /L. Windows Xp, MS-Paint, Dir ; 1. Properties 23 10111 23 27 23 17 2. Display Properties MS-Paint ok 1. Start All program
More informationChapter 1 Getting Started Structured Programming 1
Chapter 1 Getting Started 204112 Structured Programming 1 Outline Introduction to Programming Algorithm Programming Style The printf( ) Function Common Programming Errors Introduction to Modularity Top-Down
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 informationSubject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100
Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space
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 informationLAB MANUAL LAB. Regulation : 2013 Branch. : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES
LAB MANUAL Regulation : 2013 Branch : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES LAB VVIT DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1 ANNA UNIVERSITY: CHENNAI
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 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// 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 informationUnit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION
INTRODUCTION Decision Making and Looping Unit 5 In the previous lessons we have learned about the programming structure, decision making procedure, how to write statements, as well as different types of
More informationMA 511: Computer Programming Lecture 3: Partha Sarathi Mandal
MA 511: Computer Programming Lecture 3: 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 Last
More informationBCA-105 C Language What is C? History of C
C Language What is C? C is a programming language developed at AT & T s Bell Laboratories of USA in 1972. It was designed and written by a man named Dennis Ritchie. C seems so popular is because it is
More informationComputers Programming Course 5. Iulian Năstac
Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction
More informationIosif Ignat, Marius Joldoș Laboratory Guide 5. Functions. FUNCTIONS in C
FUNCTIONS in C 1. Overview The learning objective of this lab session is to: Understand the structure of a C function Understand function calls both using arguments passed by value and by reference Understand
More informationUNIT III ARRAYS AND STRINGS
UNIT III ARRAYS AND STRINGS Arrays Initialization Declaration One dimensional and Two dimensional arrays. String- String operations String Arrays. Simple programs- sorting- searching matrix operations.
More informationTHE BAPATLA ENGINEERING COLLEGE:: BAPATLA DEPARTMENT OF MCA. Subject name: C programing Lab. Subject code: MCA 107. LAB manual of c programing lab
THE BAPATLA ENGINEERING COLLEGE:: BAPATLA DEPARTMENT OF MCA Subject name: C programing Lab Subject code: MCA 107 LAB manual of c programing lab 1. Write a C program for calculating compound interest. #include
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 informationLABORATORY MANUAL. (CSE-103F) FCPC Lab
LABORATORY MANUAL (CSE-103F) FCPC Lab Department of Computer Science & Engineering BRCM College of Engineering & Technology Bahal, Haryana Aim: Main aim of this course is to understand and solve logical
More informationLesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University
Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only
More informationUIC. C Programming Primer. Bharathidasan University
C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions
More informationComputer Programing. for Physicists [SCPY204] Class 02: 25 Jan 2018
Computer Programing Class 02: 25 Jan 2018 [SCPY204] for Physicists Content: Data, Data type, program control, condition and loop, function and recursion, variable and scope Instructor: Puwis Amatyakul
More informationFundamentals of Programming
Fundamentals of Programming Introduction to the C language Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 29, 2012 G. Lipari (Scuola Superiore Sant Anna) The C language
More informationPrepared by: Shraddha Modi
Prepared by: Shraddha Modi Introduction Operator: An operator is a symbol that tells the Computer to perform certain mathematical or logical manipulations. Expression: An expression is a sequence of operands
More informationSaini Technologies ADVANCED C PROGRAMMING WITH SAINI TECHNOLOGIES. Sushil Kumar Saini Mo.
Saini Technologies ADVANCED C PROGRAMMING WITH SAINI TECHNOLOGIES Sushil Kumar Saini Email: Sushilsaini04@gmail.com Mo. 9896470047 Integer Array int a[]=12,34,54,45,34,34; printf("%d",a[0]); printf(" %d",a[1]);
More informationF.E. Sem. II. Structured Programming Approach
F.E. Sem. II Structured Programming Approach Time : 3 Hrs.] Mumbai University Examination Paper Solution - May 14 [Marks : 80 Q.1(a) What do you mean by algorithm? Which points you should consider [4]
More informationDeveloped By: P.Venkateshwarlu, Alphores Womens Degree College, Karimnagar
B.Sc (Computer Science) 1 sem Practical Solutions 1.Program to find biggest in 3 numbers using conditional operators. # include # include int a, b, c, big ; printf("enter three numbers
More informationPrepared by: Shraddha Modi
Prepared by: Shraddha Modi Introduction In looping, a sequence of statements are executed until some conditions for termination of the loop are satisfied. A program loop consist of two segments Body of
More informationInformatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 5, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
More informationIntroduction to Computing Lecture 07: Repetition and Loop Statements (Part II)
Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II) Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical & Electronics Engineering nukhet.ozbek@ege.edu.tr Topics
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 informationCSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming
CSE101-Lec#18 Multidimensional Arrays Application of arrays Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Defining and processing 1D array 2D array Applications of arrays 1-D array A
More informationVALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR
VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and
More informationProgramming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan
Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with
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 informationCharacters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters,
Strings Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, decimal digits, special characters and escape
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 informationLab Manual B.Tech 1 st Year
Lab Manual B.Tech 1 st Year Fundamentals & Computer Programming Lab Dev Bhoomi Institute of Technology Dehradun www.dbit.ac.in Affiliated to Uttrakhand Technical University, Dehradun www.uktech.in CONTENTS
More informationStructured Programming. Dr. Mohamed Khedr Lecture 4
Structured Programming Dr. Mohamed Khedr http://webmail.aast.edu/~khedr 1 Scientific Notation for floats 2.7E4 means 2.7 x 10 4 = 2.7000 = 27000.0 2.7E-4 means 2.7 x 10-4 = 0002.7 = 0.00027 2 Output Formatting
More informationF.E. Sem. II. Structured Programming Approach
F.E. Sem. II Structured Programming Approach Time : 3 Hrs.] Mumbai University Examination Paper Solution - May 13 [Marks : 80 Q.1(a) Explain the purpose of following standard library functions : [3] (i)
More informationBasics of Programming
Unit 2 Basics of Programming Problem Analysis When we are going to develop any solution to the problem, we must fully understand the nature of the problem and what we want the program to do. Without the
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 informationIECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.
Subject code - CCP01 Chapt Chapter 1 INTRODUCTION TO C 1. A group of software developed for certain purpose are referred as ---- a. Program b. Variable c. Software d. Data 2. Software is classified into
More informationUNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING
( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING INTRODUCTION TO C UNIT IV Overview of C Constants, Variables and Data Types
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 informationIosif Ignat, Marius Joldoș Laboratory Guide 4. Statements. STATEMENTS in C
STATEMENTS in C 1. Overview The learning objective of this lab is: To understand and proper use statements of C/C++ language, both the simple and structured ones: the expression statement, the empty statement,
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 informationContents ARRAYS. Introduction:
UNIT-III ARRAYS AND STRINGS Contents Single and Multidimensional Arrays: Array Declaration and Initialization of arrays Arrays as function arguments. Strings: Initialization and String handling functions.
More informationIntroduction to C++ Introduction and History. Characteristics of C++
Introduction and History Introduction to C++ Until 1980, C programming was widely popular, and slowly people started realizing the drawbacks of this language and at the same time, the engineers had come
More informationC Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); }
C Program Output #include main () { printf ( Hi everyone\n ); Hi everyone #include main () { printf ( Hi everyone\n ); #include and main are Keywords (or Reserved Words) Reserved Words
More informationC Programming Lecture V
C Programming Lecture V Instructor Özgür ZEYDAN http://cevre.beun.edu.tr/ Modular Programming A function in C is a small sub-program that performs a particular task, and supports the concept of modular
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)
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(i) Describe in detail about the classification of computers with their features and limitations(10)
UNIT I - INTRODUCTION Generation and Classification of Computers- Basic Organization of a Computer Number System Binary Decimal Conversion Problems. Need for logical analysis and thinking Algorithm Pseudo
More informationFunctions. P. S. Suryateja startertutorials.com [short domain - stuts.me] 2
UNIT - 3 FUNCTIONS Functions Until now, in all the C programs that we have written, the program consists of a main function and inside that we are writing the logic of the program. The disadvantage of
More informationTribhuvan University Institute of Science and Technology 2065
1CSc.102-2065 2065 Candidates are required to give their answers in their own words as for as practicable. 1. Draw the flow chart for finding largest of three numbers and write an algorithm and explain
More informationTo store the total marks of 100 students an array will be declared as follows,
Chapter 4 ARRAYS LEARNING OBJECTIVES After going through this chapter the reader will be able to declare and use one-dimensional and two-dimensional arrays initialize arrays use subscripts to access individual
More informationUNIT 3: ANALYSIS OF SIMPLE ALGORITHMS
UNIT 3: ANALYSIS OF SIMPLE ALGORITHMS Analysis of simple Algorithms Structure Page Nos. 3.0 Introduction 85 3.1 Objective 85 3.2 Euclid Algorithm for GCD 86 3.3 Horner s Rule for Polynomial Evaluation
More informationComputer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];
Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data
More informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
More informationC Programming Multiple. Choice
C Programming Multiple Choice Questions 1.) Developer of C language is. a.) Dennis Richie c.) Bill Gates b.) Ken Thompson d.) Peter Norton 2.) C language developed in. a.) 1970 c.) 1976 b.) 1972 d.) 1980
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 informationApplied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011
Applied Programming and Computer Science, DD2325/appcs15 PODF, Programmering och datalogi för fysiker, DA7011 Autumn 2015 Lecture 3, Simple C programming M. Eriksson (with contributions from A. Maki and
More informationMODULE V: POINTERS & PREPROCESSORS
MODULE V: POINTERS & PREPROCESSORS INTRODUCTION As you know, every variable is a memory-location and every memory-location has its address defined which can be accessed using ampersand(&) operator, which
More informationChapter 8 Character Arrays and Strings
Chapter 8 Character Arrays and Strings INTRODUCTION A string is a sequence of characters that is treated as a single data item. String constant: String constant example. \ String constant example.\ \ includes
More informationAim : To Write a C++ Program that prints a Fibonacci series
Ex:B1 Fibonacci Series Aim : To Write a C++ Program that prints a Fibonacci series #include int f1 = -1, f2=1, f3, n, i; cout < < "\n\nenter the value of N : "; cin >> n ; cout < < "\n\nfibonacci
More informationC Language Part 2 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 2 (Minor modifications by the instructor) 1 Scope Rules A variable declared inside a function is a local variable Each local variable in a function comes into existence when the function
More informationI YEAR II SEMESTER COMPUTER SCIENCE PROGRAMMING IN C
I YEAR II SEMESTER COMPUTER SCIENCE 3-2-108 UNIT I PROGRAMMING IN C Introduction to C: Introduction Structure of C Program Writing the first C Program File used in C Program Compiling and Executing C Programs
More informationC Program Development and Debugging under Unix SEEM 3460
C Program Development and Debugging under Unix SEEM 3460 1 C Basic Elements SEEM 3460 2 C - Basic Types Type (32 bit) Smallest Value Largest Value short int -32,768(-2 15 ) 32,767(2 15-1) unsigned short
More information