4(a) ADDITION OF TWO NUMBERS. Program:
|
|
- William Lawson
- 6 years ago
- Views:
Transcription
1 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 is 9
2 4(b) SWAPING OF TWO NUMBERS BY USING THIRD VARIABLE Program #include< stdio.h> #include< conio.h> int i,j; printf("enter the i & j value=\n "); scanf("%d%d",&i,&j); printf( before swap ); Printf( \n%d\n%d\n,i,j); printf( after swap ); i=i+j; j=i-j; i=i-j; Printf( \n%d\n%d\n,i,j); Output Enter the i & j value=3 4 before swap i=3 j=4 after swap i=4 j=3
3 4(c) TEMPERATURE CONVERSION Program #include <stdio.h> float celc, faren; printf("enter temperature in celsius "); scanf("%f",&celc); faren= (1.8 * celc) +32; printf("\n Temperature in Farenheit = %f", faren); Output Enter temperature in Celsius : 20 Temperature in Fahrenheit = 68.0
4 4(d) QUADRATIC FORM #include <stdio.h> #include <conio.h> #include <math.h> int a, b, c, d; float r1, r2; printf("enter co-efficient for x^2 : "); scanf("%d", &a); printf("enter co-efficient for x : "); scanf("%d", &b); printf("enter const co-efficient : "); scanf("%d", &c); d = b*b - 4*a*c; r1 = (-b + sqrt(d)) / (2.0 * a); r2 = (-b - sqrt(d)) / (2.0 * a); printf("real roots are %.2f and %.2f", r1, r2); Output: Enter co-efficient for x^2 : 2 Enter co-efficient for x : 8 Enter const co-efficient : 6 Real roots are and -3.00
5 4(e) FINDING THE AREA, CIRCUMFERENCE OF CIRCLE #include <stdio.h> #include <conio.h> #define pi 3.14 main() int radius; float area, circum; printf("enter radius of the circle : "); scanf("%d", &radius); area = pi * radius * radius; circum = 2 * pi * radius; printf("area is %.2f and circumference is %.2f",area,circum); Output: Enter radius of the circle : 8 Area is and circumference is 50.24
6 4(f) LEAP YEAR OR NOT int year; printf("enter the year\n"); scanf("%d",&year); if(year%4==0&&year%100!=0 year%400==0) printf("it is leap year"); else printf("it is not a leap year"); OUTPUT: Enter the year : 2013 It is not a leap year
7 4(g) ODD OR EVEN Program int num; printf("enter the number..."); scanf("%d",&num); if(num%2==0) printf("the given number is a Even number"); else printf("the given number is a Odd number"); Output Enter the number 5 The given number is a Odd number
8 4(h) GREATEST OF TWO NUMBERS BY USING TERNARY #include <stdio.h> #include <conio.h> int x,y,big; printf("enter the value of x,y : "); scanf("%d%d", &x &y); big=(x>y)?x:y; printf("big is.%d,big); Output: Enter the value of x,y: 5 7 Big is..7
9 5(a) GREATEST OF TWO NUMBERS BY USING IF STATEMENT int a,b; printf("enter the value of a and b\n"); scanf("%d%d",&a,&b); if(a>b) printf("%d is big",a); else printf("%d is big",b); Output: enter the value of a and b is big
10 5(b) GREATEST AMONG THREE NUMBERS USING NESTED IF STATEMENT int a,b,c; printf("enter the value of a,b,c \n"); scanf("%d%d%d",&a,&b,&c); if(a>b) if(a>c) printf("max=a"); else printf("max=c"); else if(b>c) printf("max=b"); else printf("max=c"); OUTPUT: enter the value of a,b,c max=a
11 5(C) CALCULATOR USING SWITCH CASE int a,b,c,n; printf("enter values for 'a'and 'b'\n"); scanf("%d%d",&a,&b); printf("enter the choice \n"); scanf("%d",&n); switch(n) case 1: c=a+b; printf("the value of c is %d",c); break; case 2: c=a-b; printf("the value of c is %d",c); break; case 3: c=a*b; printf("the value of c is %d",c); break; case 4: c=a/b; printf("the value of c is %d",c); break; default: printf("wrong choice!!"); OUTPUT: enter values for 'a'and 'b' 5 9 enter the choice 3 the value of c is 45
12 5(d) FIND THE SUM OF DIGITS Program int n,r,s=0; printf("enter no:"); scanf("%d",&n); while(n>0) r=n%10; s=s+r; n=n/10; printf("\nsum of digits = %d",s); OUTPUT: Enter no: 3425 Sum of digits=14
13 5(e) FINDING WHETHER A GIVEN NUMBER IS ARMSTRONG OR NOT int a,n,sum=0,c; printf("enter the number \n"); scanf("%d",&n); a=n; while(n>0) c=n%10; c=c*c*c; sum=sum+c; n=n/10; if(sum==a) printf("%d is armstrong number",sum); else printf("%d is not an armstrong number",sum); OUTPUT: enter the number is armstrong number
14 5(f) FINDING PALINDROME OR NOT int n,temp,a,rev=0; printf("enter the number\n"); scanf("%d",&n); temp=n; while(n>0) a=n%10; rev=rev*10; rev=rev+a; n=n/10; if (temp==rev) printf("it is palindrome"); else printf("it is not palindrome"); OUTPUT: enter the number 121 it is palindrome
15 5(g) PRIME NUMBER int i,n,flg=0; printf("enter the number\n"); scanf("%d",&n); for(i=2;i<=n;i++) if (n%i==0) flg=1; break(); if (flg==0) printf( the given number is prime ); else printf( the given number is not prime ); Output: Enter the number: 7 The given number is prime.
16 5(h) FIBONACCI SERIES Program int n, first = 0, second = 1, next, c; printf("enter the number of terms\n"); scanf("%d",&n); printf("first %d terms of Fibonacci series are :-\n",n); for ( c = 0 ; c < n ; c++ ) if ( c <= 1 ) next = c; else next = first + second; first = second; second = next; printf("%d\n",next); Output: Enter the number of terms: 5 First 5 terms of Fibonacci series are
17 5(i) FACTORIAL int n, i, fact; i=1; fact=1; scanf( %d, &n); printf( \n enter the number ); while(i<=n) fact=fact*i; i=i+1; printf( Factorial of n is %d, fact): Output: Enter the number: 3 Factorial of n is 6
18 5(j) THE NUMBER DIVISIBLE BY 2BUT NOT DIVISIBLE BY 3 AND 5 UPTO 100 int a,b=0 for(a=0;a<100;a++) if(a%2==0&&a%3!=0&&a%5!=0) printf( %d,a); b++; printf( no of counts %d,b); Output: No of counts: 27
19 6(a) SORTING int a[50],n,i,j,temp; printf("enter the limit \n"); scanf("%d",&n); printf("enter the array element \n"); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if (a[i]>a[j]) temp=a[i]; a[i]=a[j]; a[j]=temp; printf("the sorted element n is "); for (i=0;i<n;i++) printf("%d",a[i]);
20 OUTPUT: enter the limit 5 enter the array element the sorted element n is
21 6(b) SEARCHING #include <stdio.h> int array[100], search, c, n; printf("enter the number of elements in array\n"); scanf("%d",&n); printf("enter %d integer(s)\n", n); for (c = 0; c < n; c++) scanf("%d", &array[c]); printf("enter the number to search\n"); scanf("%d", &search); for (c = 0; c < n; c++) if (array[c] == search) printf("%d is present at location %d.\n", search, c+1); break; if (c == n) printf("%d is not present in array.\n", search);
22 OUTPUT: enter no.of. elements 5 enter the elements enter the element to be searched 5 the element 5 is in position 2
23 6(c) MATRIX ADDITION int a[10][10],b[10][10],c[10][10]; int m,n,p,q,i,j; printf("enter the row & column size of matrix a \n"); scanf("%d%d",&m,&n); printf("enter the row & column size of matrix b\n"); scanf("%d%d",&p,&q); if (m==p&&n==q) printf("enter the elements of matrix a \n"); for (i=0;i<m;i++) for (j=0;j<n;j++) scanf("%d",&a[i][j]); printf("enter the elements of matrix b \n"); for (i=0;i<p;i++) for(j=0;j<q;j++) scanf ("%d",&b[i][j]); for (i=0;i<m;i++) for (j=0;j<n;j++) c[i][j]=a[i][j]+b[i][j]; printf("the added matrix is"); for (i=0;i<m;i++) printf("\n"); for (j=0;j<n;j++) printf("%3d",c[i][j]);
24 else printf("the row & column size is invalid"); OUTPUT: enter the row & column size of matrix a 2 2 enter the row & column size of matrix b 2 2 enter the elements of matrix a enter the elements of matrix b the added matrix is
25 6(d) MATRIX MULTIPLICATION int a[10][10],b[10][10],c[10][10]; int m,n,p,q,i,j,k; printf("enter the row & column size of matrix a \n"); scanf("%d%d",&m,&n); printf("enter the row & column size of matrix b \n"); scanf("%d%d",&p,&q); if (n==p) printf("enter the elements of matrix a \n"); for (i=0;i<m;i++) for (j=0;j<n;j++) scanf("%d",&a[i][j]); printf("enter the elements of matrix b \n"); for (i=0;i<p;i++) for(j=0;j<q;j++) scanf ("%d",&b[i][j]); for (i=0;i<m;i++) for (j=0;j<n;j++) c[i][j]=0; for (k=0;k<n;k++) c[i][j]=c[i][j]+a[i][k]*b[k][j]; printf("the multiplied matrix is"); for (i=0;i<m;i++) printf("\n"); for (j=0;j<n;j++)
26 printf("%3d",c[i][j]); else printf("not possible to multiplication"); OUTPUT: enter the row & column size of matrix a 2 2 enter the row & column size of matrix b 2 2 enter the elements of matrix a enter the elements of matrix b the multiplied matrix is
27 6(e) MATRIX TRANSPOSE int a[10][10],b[10][10],m,n,i,j; printf("enter the row & column size of matrix a \n"); scanf("%d%d",&m,&n); printf("enter the elements of matrix a \n"); for (i=0;i<m;i++) for (j=0;j<n;j++) scanf("%d",&a[i][j]); for (i=0;i<m;i++) for (j=0;j<n;j++) b[i][j]=a[j][i]; printf("the matrix b is"); for(i=0;i<m;i++) printf("\n"); for(j=0;j<n;j++) printf("%3d",b[i][j]);
28 OUTPUT: enter the row & column size of matrix a 2 2 enter the elements of matrix a The matrix b is
29 7(a) STRING CONCATENATION char str1[10],str2[10],str3[10]; int i,j; printf("enter the two string:"); scanf("%s%s",&str1,&str2); for(i=0;str1[i]!='\0';i++) str3[i]=str1[i]; for(j=0;str2[j]!='\0';j++) str3[i]=str2[j]; i++; str3[i]='\0'; printf("concatenated Stringis...%s\n",str3); OUTPUT: Enter thetwo string: Anna University Concatenated stringis. AnnaUniversity
30 7(b)STRING PALINDROME USING STRING FUNCTION PROGRAM: char str1[40],str2[40]; int n; printf("enter the string 1 \n"); gets (str1); strcpy(str2,str1); strrev(str1); n=strcmp(str1,str2); if(n==0) printf("the given string is palindrome"); else printf("the given string is not palindrome"); OUTPUT: enter the string 1 MALAYALAM The given string is palindrome
31 8(a) SWAPING OF TWO NUMBERS USING CALL BY VALUE void swap(int,int); int a,b,r; printf("enter value for a&b: "); scanf("%d%d",&a,&b); swap(a,b); void swap(int a,int b) int temp; temp=a; a=b; b=temp; printf("after swapping the value for a & b is : %d %d",a,b); Output: enter the value of a & b 5 9 After swapping the value for a & b is 9 5
32 8(b) SWAPING OF TWO NUMBERS USING CALL BY REFERENCE void swap(int *num1, int *num2); int x, y; printf("\nenter First number : "); scanf("%d", &x); printf("\nenter Second number : "); scanf("%d", &y); printf("\nbefore Swaping x = %d and y = %d", x, y); swap(&x, &y); printf("\nafter Swaping x = %d and y = %d", x, y); void swap(int *num1, int *num2) int temp; temp = *num1; *num1 = *num2; *num2 = temp; Output: Enter First number :20 Enter Second number:10 Before Swaping x = 20 and y = 10 After Swaping x = 10 and y = 20
33 9(a) FACTORIAL USING RECURSION int recursive(int); void main () int a,fact; printf("enter the number:"); scanf("%u",&a); fact=recursive(a); printf("the factorial of%d is %d",a,fact); int recursive(x) int x; int f; if(x==0) return(1); else f=x*recursive(x-1); return(f); OUTPUT: Enter thenumber5 The factorial of 5 is 120
34 10(a) EMPLOYEMENT PAYROLL USING STRUCTURE struct employee char name[15]; int empid; float bsal; float net; float gross; ; struct employee emp; float hra,da,tax; printf("\nemployee Details"); printf("\nenter the employee name"); scanf("%s",&emp.name); printf("\nenter the employee id"); scanf("%d",&emp.empid); printf("\nenter the basic salary"); scanf("%f",&emp.bsal); hra=((10*emp.bsal)/100); da=((35*emp.bsal)/100); tax=((15*emp.bsal)/100); emp.gross=emp.bsal+hra+da; emp.net=emp.gross-tax; printf("\nemployee name:%s",emp.name); printf("\nemployee no:%d",emp.empid); printf("\nemployee Basic salary:%f",emp.bsal); printf("\nhra:%f",hra); printf("\nda:%f",da); printf("\ntax:%f",tax); printf("\nnetsalary%f",emp.net); printf("\ngross salary:%f",emp.gross);
35 OUTPUT: Employee Details: Enter the employee name : Robin Enter the employee Id : 100 Enter the basic salary : Employee name : Robin Employee Id : 100 Employee Basic salary : HRA : DA : 10, Tax : Gross salary :
36 10(b) STUDENT MARKLIST USING UNION PROGRAM: main() union student char name[20]; char regno[12]; int avg; char grade; stud[25],*ptr; int i,no; printf( Enter the number of the students... ); scanf( %d,&no); for(i=0;i<no;i++) printf( \n student[%d] information:\n,i+1); printf( Enter the name ); scanf( %s,stud[i].name); printf( \nenter the roll no of the student ); scanf( %s,stud[i].regno); printf( \nenter the average value of the student ); scanf( %d,&stud[i].avg); pt=stud; for(pt=stud;pt<stud+no;ptr++) if(ptr->avg<30) ptr->grade= D ; else if(ptr->avg<50) ptr->grade= C ; else if(ptr->avg<70) ptr->grade= B ; else ptr->grade= A ; printf( \n ); printf( NAME REGISTER-NO AVERAGE GRADE\n ); for(ptr=stud;ptr<stud+no;pt++) printf( %-20s%-10s,ptr->name,ptr->regno); printf( %10d \t %c\n,ptr->avg,ptr->grade);
37 OUTPUT: Enter the number of the students 3 student[1] information: Enter the name Jack Enter the roll no of the student Enter the average value of the student 90 student[2] information: Enter the name Raj Enter the roll no of the student Enter the average value of the student 88 student[3] information: Enter the name Kiran Enter the roll no of the student Enter the average value of the student 75 NAME REGISTER-NO AVERAGE GRADE Jack S Raj A Kiran B
/* 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 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 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 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 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 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 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 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 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 information***************OUTPUT*************************** Enter the two number The addition of two number is =100
/* 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
More informationEx. No. 3 C PROGRAMMING
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
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 informationClassification s of Data Structures
Linear Data Structures using Sequential organization Classification s of Data Structures Types of Data Structures Arrays Declaration of arrays type arrayname [ arraysize ]; Ex-double balance[10]; Arrays
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 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 informationKareemNaaz Matrix Divide and Sorting Algorithm
KareemNaaz Matrix Divide and Sorting Algorithm Shaik Kareem Basha* Department of Computer Science and Engineering, HITAM, India Review Article Received date: 18/11/2016 Accepted date: 13/12/2016 Published
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 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 informationMCS-011. June 2014 Solutions Manual IGNOUUSER
MCS-011 June 2014 Solutions Manual IGNOUUSER 1 1. (a) Write an algorithm and draw corresponding flowchart to calculate the factorial of a given number. Factorial of a number n n! = 1*2*3*4*...*n Algorithm
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 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 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 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 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 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 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 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 information& Technology. Expression? Statement-x. void main() int no; scanf("%d", &no); if(no%2==0) if(no%2!=0) Syllabus for 1. of execution of statements.
statement- Computer Programming and Utilization (CPU) 110003 D) Decision Control Structure (if, if, if e if, switch, ) 1 Explain if with example and draw flowchart. if is used to control the flow of execution
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 informationC PROGRAMMING. Prof. (Dr.) S. N. Mishra (Prof. & Head, Dept. of CSEA, IGIT, Sarang)
LAB MANUAL C MING Prof. (Dr.) S. N. Mishra (Prof. & Head, Dept. of CSEA, IGIT, Sarang) C MING LAB Experiment No. 1 Write a C program to find the sum of individual digits of a positive integer. Experiment
More informationSorting & Searching. Hours: 10. Marks: 16
Sorting & Searching CONTENTS 2.1 Sorting Techniques 1. Introduction 2. Selection sort 3. Insertion sort 4. Bubble sort 5. Merge sort 6. Radix sort ( Only algorithm ) 7. Shell sort ( Only algorithm ) 8.
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 informationDRONACHARYA COLLEGE OF ENGINEERING,GURGAON. Affiliated to M.D.U.,Rohtak. Approved by AICTE DEPARTMENT OF APPIED SEIENCES & HUMANITIES.
DRONACHARYA COLLEGE OF ENGINEERING,GURGAON Affiliated to M.D.U.,Rohtak Approved by AICTE DEPARTMENT OF APPIED SEIENCES & HUMANITIES Lab Manual for Fundamental of Computer Programming in C-LAB CSE-103 List
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 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 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 information2) Program To Read Two Numbers And Print The Sum Of Given Two Numbers.
1) Program to print text main() clrscr(); printf( HELLO WELCOME TO COMPUTERS ); printf( CHETTINAD KARUR 639114 ); 2) Program To Read Two Numbers And Print The Sum Of Given Two Numbers. main() int a,b,
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 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 informationGE Computer Practices Lab
GE6161 - Computer Practices Lab Manual ( First semester B.E/B.Tech. Students for the Academic Year 2015-16 ) VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 603 203 Prepared by T. Rajasekaran,
More informationModule-3: Arrays, Strings and Functions
Introduction to Arrays: Module-3: Arrays, Strings and Functions Normally, the programmer makes the use of scalar variable to store and process single value. However, it is necessary for the programmer
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 informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities
INTERNAL ASSESSMENT TEST 1 SOLUTION PART 1 1 a Define algorithm. Write an algorithm to find sum and average of three numbers. 4 An Algorithm is a step by step procedure to solve a given problem in finite
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 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 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 informationGovernment Polytechnic Muzaffarpur.
Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking
More informationonly in the space provided. Do the rough work in the space provided for it. The question paper has total 12 pages.
Instructions: Answer all five questions. Total marks = 10 x 2 + 4 x 10 = 60. Time = 2hrs. Write your answer only in the space provided. Do the rough work in the space provided for it. The question paper
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 informationProgramming & Data Structure Laboratory. Arrays, pointers and recursion Day 5, August 5, 2014
Programming & Data Structure Laboratory rrays, pointers and recursion Day 5, ugust 5, 2014 Pointers and Multidimensional rray Function and Recursion Counting function calls in Fibonacci #include
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 informationLab Session # 1 Introduction to C Language. ALQUDS University Department of Computer Engineering
2013/2014 Programming Fundamentals for Engineers Lab Lab Session # 1 Introduction to C Language ALQUDS University Department of Computer Engineering Objective: Our objective for today s lab session is
More informationB. V. Patel Institute of Business Management, Computer & Information Technology, UTU 2013
Information Technology, UTU 203 030000 Fundamentals of Programming Problems to be solved in laboratory Note: Journal should contain followings for all problems given below:. Problem Statement 2. Algorithm
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 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 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 informationDecision Making and Branching
INTRODUCTION Decision Making and Branching Unit 4 In the previous lessons we have learned about the programming structure, data types, declaration of variables, tokens, constants, keywords and operators
More informationList of Programs: Programs: 1. Polynomial addition
List of Programs: 1. Polynomial addition 2. Common operations on vectors in c 3. Matrix operation: multiplication, transpose 4. Basic Unit conversion 5. Number conversion: Decimal to binary 6. Number conversion:
More informationUNIT III (PART-II) & UNIT IV(PART-I)
UNIT III (PART-II) & UNIT IV(PART-I) Function: it is defined as self contained block of code to perform a task. Functions can be categorized to system-defined functions and user-defined functions. System
More informationCREATING ADVERTISEMENT
MICROSOFT WORD Ex.No:1a Date: CREATING ADVERTISEMENT AIM: To prepare an advertisement for a company with some specifications. Attractive page border. Use at least one Clip Art. Design name using Word Art.
More informationSELECTION STATEMENTS:
UNIT-2 STATEMENTS A statement is a part of your program that can be executed. That is, a statement specifies an action. Statements generally contain expressions and end with a semicolon. Statements that
More informationCPS 101 Introduction to Computational Science
CPS 101 Introduction to Computational Science Wensheng Shen Department of Computational Science SUNY Brockport Chapter 10: Program in C Why C language: C is the language which can be used for both system
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 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 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 informationECE15: Introduction to Computer Programming Using the C Language. Lecture Unit 4: Flow of Control
ECE15: Introduction to Computer Programming Using the C Language Lecture Unit 4: Flow of Control Outline of this Lecture Examples of Statements in C Conditional Statements The if-else Conditional Statement
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 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 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 information1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement
UNIT- II: Control Flow: Statements and Blocks, if, switch statements, Loops: while, do-while, for, break and continue, go to and Labels. Arrays and Strings: Introduction, One- dimensional arrays, Declaring
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 informationBITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER
BITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER 2017-2018 COURSE : COMPUTER PROGRAMMING (CS F111) COMPONENT : Tutorial#4 (SOLUTION) DATE : 09-NOV-2017 Answer 1(a). #include
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 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 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 informationComputer Programming. Decision Making (2) Loops
Computer Programming Decision Making (2) Loops Topics The Conditional Execution of C Statements (review) Making a Decision (review) If Statement (review) Switch-case Repeating Statements while loop Examples
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 informationChapter 2. Introduction to C language. Together Towards A Green Environment
Chapter 2 Introduction to C language Aim Aim of this chapter is to provide the fundamentals for basic program construction using C. Objectives To understand the basic information such as keywords, character
More informationArrays a kind of data structure that can store a fixedsize sequential collection of elements of the same type. An array is used to store a collection
Morteza Noferesti Arrays a kind of data structure that can store a fixedsize sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful
More informationModule-2: Branching and Looping
Module-2: Branching and Looping Branching Statements: In sequential control, all the statements are executed in the order in which they are written sequentially in a program from top to bottom. However,
More informationC/Java Syntax. January 13, Slides by Mark Hancock (adapted from notes by Craig Schock)
C/Java Syntax 1 Lecture 02 Summary Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 2 By the end of this lecture, you will be able to identify the
More informationC/Java Syntax. Lecture 02 Summary. Keywords Variable Declarations Data Types Operators Statements. Functions. if, switch, while, do-while, for
C/Java Syntax 1 Lecture 02 Summary Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 2 1 By the end of this lecture, you will be able to identify
More informationSample Paper - II Subject Computer Science
Sample Paper - II Subject Computer Science Max Marks 70 Duration 3 hrs Note:- All questions are compulsory Q1) a) What is significance of My Computer? 2 b) Explain different types of operating systems.
More information