This document lists 100 C programming problems/exercises ranging from basic to more advanced concepts. The problems cover topics such as printing text, reading input, arithmetic operations, conditional statements, loops, functions, arrays, strings, structures, pointers, files and more. Sample code is provided for each problem to demonstrate how it can be solved in C.
The document discusses numerical approximation and significant figures. It begins by explaining what significant figures are and how they are used to determine the accuracy of measurements. It then provides examples of measurements with different numbers of significant figures. The main points are that numerical methods provide approximate results, and significant figures are used to specify the accuracy of those results in terms of the number of figures that can be reliably used.
Math 131 he goal of this lab is to find descriptive statistics/tutorialoutletHussanz
FOR MORE CLASSES VISIT
tutorialoutletdotcom
MATH 131
Lab 3 8/16 The goal of this lab is to find descriptive statistics for your quantitative data.
Part 1: V2, Quantitative Data
(3 points) Use the list of all 40 numbers from Lab 1, column V2 for this part of the lab.
The document lists 59 C programming problems ranging from finding the greatest of n numbers, roots of a quadratic equation, area of figures, sum of digits in a number, prime numbers from 1 to 100, matrix addition and subtraction, Fibonacci series, Armstrong numbers, factorials, and more. It includes problems involving arrays, strings, pointers, functions, loops, conditional statements, and other core C programming concepts. Many problems require taking input from the user at runtime and performing operations or conditional checking on the values entered.
This document outlines 75 programming assignments covering fundamental C programming concepts like loops, arrays, pointers, strings, functions, structures, unions, and file handling. Students are instructed to only code the programs marked with asterisks in their lab assignment. The document provides the assignment questions, descriptions and page numbers. It also includes a link and QR code for online access to the file containing the full assignment details.
1. The document lists 30 programming problems commonly asked during interviews for C programming jobs. The problems cover a range of concepts like recursion, data structures, algorithms, and string manipulation.
2. Example problems include writing programs to find the factorial of a number, check if a number is prime, swap two numbers without a temporary variable, find the greatest among three numbers, and check if a number is a palindrome.
3. Many problems ask the candidate to solve the problem in unique ways, like printing text without using semicolons or specific functions. This tests their creativity and problem-solving abilities in C.
The document outlines Java programming assignments divided into six labs. The assignments include programs to check for palindromes, find factors, calculate Fibonacci series, sort arrays, use threads and runnable interfaces, handle exceptions, create an applet calculator, and connect to databases. The labs cover programming concepts such as recursion, classes, strings, arrays, sockets, and database access.
Important C program of Balagurusamy BookAbir Hossain
This document contains summaries of multiple programming labs involving different programming concepts like functions, arrays, strings, conditionals, loops, etc. The labs cover basics like printing an address, calculating expressions, finding roots of equations, computing trigonometric functions; conditionals like determining if a number is even/odd, larger/smaller; functions including calculating factorial, power series, fibonacci series; arrays for storing student marks, vote counting; strings for manipulation and analysis.
The document discusses numerical approximation and significant figures. It begins by explaining what significant figures are and how they are used to determine the accuracy of measurements. It then provides examples of measurements with different numbers of significant figures. The main points are that numerical methods provide approximate results, and significant figures are used to specify the accuracy of those results in terms of the number of figures that can be reliably used.
Math 131 he goal of this lab is to find descriptive statistics/tutorialoutletHussanz
FOR MORE CLASSES VISIT
tutorialoutletdotcom
MATH 131
Lab 3 8/16 The goal of this lab is to find descriptive statistics for your quantitative data.
Part 1: V2, Quantitative Data
(3 points) Use the list of all 40 numbers from Lab 1, column V2 for this part of the lab.
The document lists 59 C programming problems ranging from finding the greatest of n numbers, roots of a quadratic equation, area of figures, sum of digits in a number, prime numbers from 1 to 100, matrix addition and subtraction, Fibonacci series, Armstrong numbers, factorials, and more. It includes problems involving arrays, strings, pointers, functions, loops, conditional statements, and other core C programming concepts. Many problems require taking input from the user at runtime and performing operations or conditional checking on the values entered.
This document outlines 75 programming assignments covering fundamental C programming concepts like loops, arrays, pointers, strings, functions, structures, unions, and file handling. Students are instructed to only code the programs marked with asterisks in their lab assignment. The document provides the assignment questions, descriptions and page numbers. It also includes a link and QR code for online access to the file containing the full assignment details.
1. The document lists 30 programming problems commonly asked during interviews for C programming jobs. The problems cover a range of concepts like recursion, data structures, algorithms, and string manipulation.
2. Example problems include writing programs to find the factorial of a number, check if a number is prime, swap two numbers without a temporary variable, find the greatest among three numbers, and check if a number is a palindrome.
3. Many problems ask the candidate to solve the problem in unique ways, like printing text without using semicolons or specific functions. This tests their creativity and problem-solving abilities in C.
The document outlines Java programming assignments divided into six labs. The assignments include programs to check for palindromes, find factors, calculate Fibonacci series, sort arrays, use threads and runnable interfaces, handle exceptions, create an applet calculator, and connect to databases. The labs cover programming concepts such as recursion, classes, strings, arrays, sockets, and database access.
Important C program of Balagurusamy BookAbir Hossain
This document contains summaries of multiple programming labs involving different programming concepts like functions, arrays, strings, conditionals, loops, etc. The labs cover basics like printing an address, calculating expressions, finding roots of equations, computing trigonometric functions; conditionals like determining if a number is even/odd, larger/smaller; functions including calculating factorial, power series, fibonacci series; arrays for storing student marks, vote counting; strings for manipulation and analysis.
This document provides an overview of arrays in Java programming. It discusses declaring and initializing single and multi-dimensional arrays, referencing array elements, and manipulating array values. The document includes 3 sample programming exercises - converting a decimal number to binary, octal, or hexadecimal using arrays; filling an array from user input and calculating percentages; and storing student data in a 2D array. It poses 2 questions about when arrays are necessary and common uses of single dimensional arrays.
The document provides information about a computer programming laboratory manual, including:
- An overview of the functional blocks of a computer including the input, output, and system units.
- Descriptions of the CPU, memory, buses, motherboard, and operating systems.
- A syllabus and contents listing for 14 computer programming experiments in C.
- Details of sessions covering computer components and programming concepts like flowcharts.
The document outlines a series of programming exercises involving one and two dimensional arrays in C++, including reversing and performing operations on a 1D array, searching arrays, scalar multiplication, finding intersections, unions, and complements of arrays, manipulating 2D arrays by replacing values and positions, performing matrix addition, multiplication, and column swapping, checking for magic squares, and an optional bonus exercise to create an X O game. Students are to write C++ programs to complete the various array and matrix manipulation tasks outlined in the seven sections.
The document contains the details of a laboratory manual for a programming course. It lists 16 programming tasks to be completed under two parts - Part A and Part B. It includes tasks like printing the reverse of a number, checking if a matrix is an identity matrix, finding the Fibonacci series, sorting arrays, file handling and more. Each task has the aim, algorithm and sample code. The document also has fields for date, topic, page number and marks for each task.
This document lists 61 questions about C programming concepts and problems to solve including: writing programs to calculate sums of array elements with pointers, display calendar information, find prime numbers within ranges, check for palindromes, solve quadratic equations, print Fibonacci sequences, and perform operations on matrices like addition, multiplication, finding diagonals. It also includes questions about series summation, manipulating arrays like deleting duplicates, inserting/deleting elements, and separating arrays into even and odd elements.
The document discusses several algorithms:
1. Program verification - A technique to mathematically prove that a program's output matches its specifications for any input.
2. Algorithm efficiency - Designing algorithms that are economical with resources like time and memory.
3. Analysis of algorithms - Qualities like correctness, understandability and efficiency.
It then provides examples of algorithms for:
1. Swapping variable values
2. Counting elements that meet a condition in a set
3. Summing a set of numbers
4. Computing factorials
5. Evaluating trigonometric functions like sine
This document provides instructions for 6 exercises in an introduction to arrays homework assignment. The exercises involve: 1) analyzing input numbers stored in an array, 2) converting dates to English from a formatted string using arrays of months and number of days, 3) finding the average temperature and months above average using parallel arrays, 4) implementing the Sieve of Eratosthenes algorithm to find prime numbers using an array, 5) grading multiple choice exams by comparing answer arrays, and 6) displaying student grades by reading data from a file into parallel arrays.
Chapter 8Exercise1.Design an application that accept.docxtiffanyd4
Chapter 8
Exercise
1.
Design an application that accepts 10 numbers and displays them in descending order.
4. The village of Ringwood conducted a census and created records that contain household data, including income. Ringwood has exactly 75 households. Write a program into which a village statistician can enter each of the 75 household income values, and determine the mean and median house-hold income.
13. Your student disk contains fi les named DEBUG08- 01. txt, DEBUG08- 02. txt, and DEBUG08- 03. txt. Each fi le starts with some comments that describe the problem. Comments are lines that begin with two slashes (//). Following the comments, each fi le contains pseudocode that has one or more bugs you must fi nd and correct.
08-01
// This application reads 10 numbers
// and sorts them, and displays the three highest numbers
start
Declarations
num SIZE = 10
num number
num numbers[SIZE]
num count
getReady()
while count < SIZE
detailLoop()
endwhile
finish()
stop
getReady()
output "Enter a number "
input number
return
detailLoop()
numbers[SIZE] = number
count = count + 1
output "Enter a number "
input number
return
finish()
sort()
output "The highest three are ", numbers[0], numbers[0], numbers[0]
return
sort()
num x = 0
num y = 0
num COMPS = count - 1
while y < COMPS
x = 0
while x < COMPS
if numbers[x] < numbers[x + 1] then
swap()
endif
x = x + 1
endwhile
y = y + 1
endwhile
return
swap()
num temp
temp = numbers[x + 1]
numbers[x + 1] = numbers[x]
numbers[x] = temp
return
08-02
// This application reads student typing test data
// including number of errors on the test, and the number
// of words typed per minute. Grades are assigned based
// on the following table:
//
Errors
// Speed
0
1
2 or more
// 0–30
C
D
F
// 31–50
C
C
F
// 51–80
B
C
D
// 81–100
A
B
C
// 101 and up
A
A
B
start
Declarations
num MAX_ERRORS = 2
num errors
num wordsPerMinute
num grades[5][3] = {"C", "D", "F"},
{"C", "C", "F"},
{"B", "C", "D"},
{"A", "B", "C"},
{"A", "A", "B"}
num LIMITS = 5
num speedLimits[LIMITS] = 0, 31, 51, 81, 101
num row
output "Enter number of errors on the test "
input errors
if errors = MAX_ERRORS then
errors > MAX_ERRORS
endif
output "Enter the speed in words per minute "
input wordsPerMinute
while row < LIMITS AND wordsPerMinute >= speedLimits[row]
row = row + 1
endwhile
row = row - 1
output "Your grade is ", grades[errors][row]
stop
08-03
This application reads sales data for an automobile dealership.
// Up to 100 sale amounts can be entered. The entered sale amounts
// are sorted so the median sale can be displayed.
start
Declarations
num SIZE = 100
num QUIT = 99999
num saleAmount
num sales[SIZE]
num count = 0
num middlePosition
num x
num y
num temp
num comps
getReady()
while saleAmount count < SIZE
detailLoop()
endwhile
finish()
stop
getReady()
output "Enter sale amount "
input saleAmount
return
detailLoop()
sales[x] = saleAmount
co.
Hi, I’m Dr. Jilesh !A professional spell caster,
– Expert in Hoodoo / conjure works, Angelic Healer (Academy of Ancient Magick)
-Tarot Reader, Psychotherapist, Reiki Grand Master 9th degree (Authorized instructor and trainer)
Check this link
This document provides an overview of the C programming language and includes 97 C programming problems and their solutions. It begins with the basics of C including history, why C is used, data types, operators, control structures, functions, arrays, pointers, structures and file handling. It then lists 97 programming problems covering simple programs, conditional statements, loops, strings, arrays, structures, functions, pointers and file handling. The problems increase in complexity and cover most fundamental concepts of C programming.
Develop a system flowchart and then write a menu-driven C++ program .pdfleventhalbrad49439
Develop a system flowchart and then write a menu-driven C++ program that uses user-defined
functions arrays, and a random number generator.
Upon program execution, the screen will be cleared and the menu shown below will appear at
the top of the screen and centered. The menu items are explained below.
Help Smallest Largest Quit
H or h ( for Help ) option will invoke a function named help() which will display a help screen.
The help screen(s) should guide the user how to interact with the program, type of data to be
used, and what results would the program produce. Each help screen should remain on the
monitor until the user strikes any key. Once the user completes reading the help() screens,
striking any key will clear the screen and the menu is displayed again.
The main() function will declare an array of 60 elements. The elements are of type double. The
menu options S and L, will ask the user for the actual number of elements for the array. The
program must verify that the actual number of elements does not exceed 60 and is not a negative
number or 0. Your code must check for these.
S or s ( for Smallest ) option will invoke a function named smallest( ) which will prompt the user
for the number of elements for the array to be examined using the function sizeOfArray( ) which
will read and validate the desired array elements and returns it to the calling function. The
program will then use the returned size of the array to fill the array using the number generator
functions shown at the end of this assignment. Your program will ask the user for the range of
values for the elements of the array and uses these numbers in a random generator function to fill
the array. Once the array is filled, the program will call the function findSmallest( ) which will
find and return the smallest number in the array to the calling function. The program will then
call the function frequency(), that will compute and return the frequency of occurrence of the
smallest number. The program will then display the array elements, the smallest number, and its
frequency of occurrence using the function display( ), in the format shown below. The output
shown is for an array of six elements with an array identifier a.
a[0] = xxxx.xx
a[1] = xxxx.xx
a[2] = xxxx.xx
a[3] = xxxx.xx
a[4] = xxxx.xx
a[5] = xxxx.xx
Smallest no. = xxxx.xx Frequency = xx
Note that for the array elements, two digits after the decimal point is required (i.e., 365.24) and
the frequence of occurrence is of type integer.
The function prototypes to be used are as follows:
void smallest(double s[], int size);
where s is the original array declared in the main() function and size is the maximum array size
specified (60 elements in our case).
//gets the desired array size and returns it
int sizeOfArray(void);
//finds the smallest number in the array and returns it via the return statement.
double findSmallest(double s[], int myS);
//where s is the specified array name and myS is the desired size of the array.
The document is a computer programming laboratory manual for Malla Reddy College of Engineering & Technology. It contains instructions for students attending the lab and outlines 16 weeks of programming exercises for students to complete. The exercises include programs to calculate sums and averages, generate Fibonacci sequences, check for prime and Armstrong numbers, perform matrix operations, work with strings and files, and more. It provides the goals, algorithms, flowcharts and programs for students to write and test out for each week's assignments.
The document contains descriptions of 83 Java programming problems involving topics such as calculating areas and perimeters of shapes, prime numbers, palindromes, Fibonacci series, arrays, strings, classes, objects, inheritance, polymorphism, interfaces, exception handling, file handling, and more. Many problems require reading input, processing data, and displaying output using concepts like classes, objects, methods, and exception handling.
This document contains a list of 53 Java programming practical assignments covering topics like arrays, strings, classes, inheritance, exceptions, I/O, applets, GUI components, and multithreading. The assignments involve writing programs to print names from command line arguments, calculate averages, manipulate arrays and strings, define classes for shapes and boxes, handle exceptions, read/write files, draw graphics in applets, add GUI components to frames, and simulate multithreaded processes.
This document contains a collection of programming problems and exercises across multiple topics including arithmetic operations, area calculations, data interchange, temperature conversions, grade/mark calculations, ASCII values, digit/number manipulations, character classifications, string manipulations, conditionals, recursion, sorting, arrays, and more. Solutions are to be written as WAP (Write A Program) in various labs.
This document outlines 5 problems for a homework assignment on input/output (I/O) and arrays in C++. Problem 1 involves reading a data file and calculating the median and quartiles. Problem 2 calculates the average and standard deviation of numbers in a file. Problem 3 merges two sorted files of numbers into a third file. Problem 4 performs hexadecimal addition with overflow checking. Problem 5 defines a function to remove repeated characters from a partially filled array.
The document discusses various methods related to arrays in Java including:
1) Declaring and populating an array of words from user input and displaying the array.
2) Declaring an integer array, assigning values based on index * 3, and printing selected elements.
3) Removing duplicate strings from an array of user-input strings.
4) Counting vowels in an array of characters.
5) Reading integers into an array, finding the maximum and minimum values, swapping their positions, and printing the result.
6) Setting up an integer array of random values, sorting in ascending and descending order, and searching for an element.
7) Checking if two strings are anagrams by re
This document contains practice questions on various Java programming concepts like basic Java, data types, operators, input from user, decision making, loops, arrays, and user defined methods. Some key questions include:
1. Print patterns like stars, numbers, multiplication tables using loops.
2. Take input from user, perform calculations based on conditions, and display output.
3. Define methods to find maximum/minimum, check prime numbers, calculate factorials.
4. Store user input in arrays, manipulate array elements like reversing, splitting, sorting.
This document contains a list of Java programming lab assignments with questions ranging from basic programming concepts like variables, conditionals, loops, methods and classes to more advanced topics like inheritance, abstraction, polymorphism and exceptions. Some questions involve writing simple programs to calculate things like pay, time conversions or name formatting while others require designing classes and relationships between them. The assignments cover core Java programming techniques and principles.
This document provides instructions and materials for a course project on solving problems using computer programming. It includes two problems - counting prime numbers below 10,000 and counting triangular numbers below 1,000,000. Algorithms are presented for both problems using pseudocode. Students are instructed to implement the algorithms in Scratch or another programming language. Sample Scratch and Python programs are included, along with testing to validate the outputs against known results. The document aims to help students learn programming skills through solving mathematical problems.
Job Finding Apps Everything You Need to Know in 2024SnapJob
SnapJob is revolutionizing the way people connect with work opportunities and find talented professionals for their projects. Find your dream job with ease using the best job finding apps. Discover top-rated apps that connect you with employers, provide personalized job recommendations, and streamline the application process. Explore features, ratings, and reviews to find the app that suits your needs and helps you land your next opportunity.
A Guide to a Winning Interview June 2024Bruce Bennett
This webinar is an in-depth review of the interview process. Preparation is a key element to acing an interview. Learn the best approaches from the initial phone screen to the face-to-face meeting with the hiring manager. You will hear great answers to several standard questions, including the dreaded “Tell Me About Yourself”.
This document provides an overview of arrays in Java programming. It discusses declaring and initializing single and multi-dimensional arrays, referencing array elements, and manipulating array values. The document includes 3 sample programming exercises - converting a decimal number to binary, octal, or hexadecimal using arrays; filling an array from user input and calculating percentages; and storing student data in a 2D array. It poses 2 questions about when arrays are necessary and common uses of single dimensional arrays.
The document provides information about a computer programming laboratory manual, including:
- An overview of the functional blocks of a computer including the input, output, and system units.
- Descriptions of the CPU, memory, buses, motherboard, and operating systems.
- A syllabus and contents listing for 14 computer programming experiments in C.
- Details of sessions covering computer components and programming concepts like flowcharts.
The document outlines a series of programming exercises involving one and two dimensional arrays in C++, including reversing and performing operations on a 1D array, searching arrays, scalar multiplication, finding intersections, unions, and complements of arrays, manipulating 2D arrays by replacing values and positions, performing matrix addition, multiplication, and column swapping, checking for magic squares, and an optional bonus exercise to create an X O game. Students are to write C++ programs to complete the various array and matrix manipulation tasks outlined in the seven sections.
The document contains the details of a laboratory manual for a programming course. It lists 16 programming tasks to be completed under two parts - Part A and Part B. It includes tasks like printing the reverse of a number, checking if a matrix is an identity matrix, finding the Fibonacci series, sorting arrays, file handling and more. Each task has the aim, algorithm and sample code. The document also has fields for date, topic, page number and marks for each task.
This document lists 61 questions about C programming concepts and problems to solve including: writing programs to calculate sums of array elements with pointers, display calendar information, find prime numbers within ranges, check for palindromes, solve quadratic equations, print Fibonacci sequences, and perform operations on matrices like addition, multiplication, finding diagonals. It also includes questions about series summation, manipulating arrays like deleting duplicates, inserting/deleting elements, and separating arrays into even and odd elements.
The document discusses several algorithms:
1. Program verification - A technique to mathematically prove that a program's output matches its specifications for any input.
2. Algorithm efficiency - Designing algorithms that are economical with resources like time and memory.
3. Analysis of algorithms - Qualities like correctness, understandability and efficiency.
It then provides examples of algorithms for:
1. Swapping variable values
2. Counting elements that meet a condition in a set
3. Summing a set of numbers
4. Computing factorials
5. Evaluating trigonometric functions like sine
This document provides instructions for 6 exercises in an introduction to arrays homework assignment. The exercises involve: 1) analyzing input numbers stored in an array, 2) converting dates to English from a formatted string using arrays of months and number of days, 3) finding the average temperature and months above average using parallel arrays, 4) implementing the Sieve of Eratosthenes algorithm to find prime numbers using an array, 5) grading multiple choice exams by comparing answer arrays, and 6) displaying student grades by reading data from a file into parallel arrays.
Chapter 8Exercise1.Design an application that accept.docxtiffanyd4
Chapter 8
Exercise
1.
Design an application that accepts 10 numbers and displays them in descending order.
4. The village of Ringwood conducted a census and created records that contain household data, including income. Ringwood has exactly 75 households. Write a program into which a village statistician can enter each of the 75 household income values, and determine the mean and median house-hold income.
13. Your student disk contains fi les named DEBUG08- 01. txt, DEBUG08- 02. txt, and DEBUG08- 03. txt. Each fi le starts with some comments that describe the problem. Comments are lines that begin with two slashes (//). Following the comments, each fi le contains pseudocode that has one or more bugs you must fi nd and correct.
08-01
// This application reads 10 numbers
// and sorts them, and displays the three highest numbers
start
Declarations
num SIZE = 10
num number
num numbers[SIZE]
num count
getReady()
while count < SIZE
detailLoop()
endwhile
finish()
stop
getReady()
output "Enter a number "
input number
return
detailLoop()
numbers[SIZE] = number
count = count + 1
output "Enter a number "
input number
return
finish()
sort()
output "The highest three are ", numbers[0], numbers[0], numbers[0]
return
sort()
num x = 0
num y = 0
num COMPS = count - 1
while y < COMPS
x = 0
while x < COMPS
if numbers[x] < numbers[x + 1] then
swap()
endif
x = x + 1
endwhile
y = y + 1
endwhile
return
swap()
num temp
temp = numbers[x + 1]
numbers[x + 1] = numbers[x]
numbers[x] = temp
return
08-02
// This application reads student typing test data
// including number of errors on the test, and the number
// of words typed per minute. Grades are assigned based
// on the following table:
//
Errors
// Speed
0
1
2 or more
// 0–30
C
D
F
// 31–50
C
C
F
// 51–80
B
C
D
// 81–100
A
B
C
// 101 and up
A
A
B
start
Declarations
num MAX_ERRORS = 2
num errors
num wordsPerMinute
num grades[5][3] = {"C", "D", "F"},
{"C", "C", "F"},
{"B", "C", "D"},
{"A", "B", "C"},
{"A", "A", "B"}
num LIMITS = 5
num speedLimits[LIMITS] = 0, 31, 51, 81, 101
num row
output "Enter number of errors on the test "
input errors
if errors = MAX_ERRORS then
errors > MAX_ERRORS
endif
output "Enter the speed in words per minute "
input wordsPerMinute
while row < LIMITS AND wordsPerMinute >= speedLimits[row]
row = row + 1
endwhile
row = row - 1
output "Your grade is ", grades[errors][row]
stop
08-03
This application reads sales data for an automobile dealership.
// Up to 100 sale amounts can be entered. The entered sale amounts
// are sorted so the median sale can be displayed.
start
Declarations
num SIZE = 100
num QUIT = 99999
num saleAmount
num sales[SIZE]
num count = 0
num middlePosition
num x
num y
num temp
num comps
getReady()
while saleAmount count < SIZE
detailLoop()
endwhile
finish()
stop
getReady()
output "Enter sale amount "
input saleAmount
return
detailLoop()
sales[x] = saleAmount
co.
Hi, I’m Dr. Jilesh !A professional spell caster,
– Expert in Hoodoo / conjure works, Angelic Healer (Academy of Ancient Magick)
-Tarot Reader, Psychotherapist, Reiki Grand Master 9th degree (Authorized instructor and trainer)
Check this link
This document provides an overview of the C programming language and includes 97 C programming problems and their solutions. It begins with the basics of C including history, why C is used, data types, operators, control structures, functions, arrays, pointers, structures and file handling. It then lists 97 programming problems covering simple programs, conditional statements, loops, strings, arrays, structures, functions, pointers and file handling. The problems increase in complexity and cover most fundamental concepts of C programming.
Develop a system flowchart and then write a menu-driven C++ program .pdfleventhalbrad49439
Develop a system flowchart and then write a menu-driven C++ program that uses user-defined
functions arrays, and a random number generator.
Upon program execution, the screen will be cleared and the menu shown below will appear at
the top of the screen and centered. The menu items are explained below.
Help Smallest Largest Quit
H or h ( for Help ) option will invoke a function named help() which will display a help screen.
The help screen(s) should guide the user how to interact with the program, type of data to be
used, and what results would the program produce. Each help screen should remain on the
monitor until the user strikes any key. Once the user completes reading the help() screens,
striking any key will clear the screen and the menu is displayed again.
The main() function will declare an array of 60 elements. The elements are of type double. The
menu options S and L, will ask the user for the actual number of elements for the array. The
program must verify that the actual number of elements does not exceed 60 and is not a negative
number or 0. Your code must check for these.
S or s ( for Smallest ) option will invoke a function named smallest( ) which will prompt the user
for the number of elements for the array to be examined using the function sizeOfArray( ) which
will read and validate the desired array elements and returns it to the calling function. The
program will then use the returned size of the array to fill the array using the number generator
functions shown at the end of this assignment. Your program will ask the user for the range of
values for the elements of the array and uses these numbers in a random generator function to fill
the array. Once the array is filled, the program will call the function findSmallest( ) which will
find and return the smallest number in the array to the calling function. The program will then
call the function frequency(), that will compute and return the frequency of occurrence of the
smallest number. The program will then display the array elements, the smallest number, and its
frequency of occurrence using the function display( ), in the format shown below. The output
shown is for an array of six elements with an array identifier a.
a[0] = xxxx.xx
a[1] = xxxx.xx
a[2] = xxxx.xx
a[3] = xxxx.xx
a[4] = xxxx.xx
a[5] = xxxx.xx
Smallest no. = xxxx.xx Frequency = xx
Note that for the array elements, two digits after the decimal point is required (i.e., 365.24) and
the frequence of occurrence is of type integer.
The function prototypes to be used are as follows:
void smallest(double s[], int size);
where s is the original array declared in the main() function and size is the maximum array size
specified (60 elements in our case).
//gets the desired array size and returns it
int sizeOfArray(void);
//finds the smallest number in the array and returns it via the return statement.
double findSmallest(double s[], int myS);
//where s is the specified array name and myS is the desired size of the array.
The document is a computer programming laboratory manual for Malla Reddy College of Engineering & Technology. It contains instructions for students attending the lab and outlines 16 weeks of programming exercises for students to complete. The exercises include programs to calculate sums and averages, generate Fibonacci sequences, check for prime and Armstrong numbers, perform matrix operations, work with strings and files, and more. It provides the goals, algorithms, flowcharts and programs for students to write and test out for each week's assignments.
The document contains descriptions of 83 Java programming problems involving topics such as calculating areas and perimeters of shapes, prime numbers, palindromes, Fibonacci series, arrays, strings, classes, objects, inheritance, polymorphism, interfaces, exception handling, file handling, and more. Many problems require reading input, processing data, and displaying output using concepts like classes, objects, methods, and exception handling.
This document contains a list of 53 Java programming practical assignments covering topics like arrays, strings, classes, inheritance, exceptions, I/O, applets, GUI components, and multithreading. The assignments involve writing programs to print names from command line arguments, calculate averages, manipulate arrays and strings, define classes for shapes and boxes, handle exceptions, read/write files, draw graphics in applets, add GUI components to frames, and simulate multithreaded processes.
This document contains a collection of programming problems and exercises across multiple topics including arithmetic operations, area calculations, data interchange, temperature conversions, grade/mark calculations, ASCII values, digit/number manipulations, character classifications, string manipulations, conditionals, recursion, sorting, arrays, and more. Solutions are to be written as WAP (Write A Program) in various labs.
This document outlines 5 problems for a homework assignment on input/output (I/O) and arrays in C++. Problem 1 involves reading a data file and calculating the median and quartiles. Problem 2 calculates the average and standard deviation of numbers in a file. Problem 3 merges two sorted files of numbers into a third file. Problem 4 performs hexadecimal addition with overflow checking. Problem 5 defines a function to remove repeated characters from a partially filled array.
The document discusses various methods related to arrays in Java including:
1) Declaring and populating an array of words from user input and displaying the array.
2) Declaring an integer array, assigning values based on index * 3, and printing selected elements.
3) Removing duplicate strings from an array of user-input strings.
4) Counting vowels in an array of characters.
5) Reading integers into an array, finding the maximum and minimum values, swapping their positions, and printing the result.
6) Setting up an integer array of random values, sorting in ascending and descending order, and searching for an element.
7) Checking if two strings are anagrams by re
This document contains practice questions on various Java programming concepts like basic Java, data types, operators, input from user, decision making, loops, arrays, and user defined methods. Some key questions include:
1. Print patterns like stars, numbers, multiplication tables using loops.
2. Take input from user, perform calculations based on conditions, and display output.
3. Define methods to find maximum/minimum, check prime numbers, calculate factorials.
4. Store user input in arrays, manipulate array elements like reversing, splitting, sorting.
This document contains a list of Java programming lab assignments with questions ranging from basic programming concepts like variables, conditionals, loops, methods and classes to more advanced topics like inheritance, abstraction, polymorphism and exceptions. Some questions involve writing simple programs to calculate things like pay, time conversions or name formatting while others require designing classes and relationships between them. The assignments cover core Java programming techniques and principles.
This document provides instructions and materials for a course project on solving problems using computer programming. It includes two problems - counting prime numbers below 10,000 and counting triangular numbers below 1,000,000. Algorithms are presented for both problems using pseudocode. Students are instructed to implement the algorithms in Scratch or another programming language. Sample Scratch and Python programs are included, along with testing to validate the outputs against known results. The document aims to help students learn programming skills through solving mathematical problems.
Job Finding Apps Everything You Need to Know in 2024SnapJob
SnapJob is revolutionizing the way people connect with work opportunities and find talented professionals for their projects. Find your dream job with ease using the best job finding apps. Discover top-rated apps that connect you with employers, provide personalized job recommendations, and streamline the application process. Explore features, ratings, and reviews to find the app that suits your needs and helps you land your next opportunity.
A Guide to a Winning Interview June 2024Bruce Bennett
This webinar is an in-depth review of the interview process. Preparation is a key element to acing an interview. Learn the best approaches from the initial phone screen to the face-to-face meeting with the hiring manager. You will hear great answers to several standard questions, including the dreaded “Tell Me About Yourself”.
Leadership Ambassador club Adventist modulekakomaeric00
Aims to equip people who aspire to become leaders with good qualities,and with Christian values and morals as per Biblical teachings.The you who aspire to be leaders should first read and understand what the ambassador module for leadership says about leadership and marry that to what the bible says.Christians sh
5 Common Mistakes to Avoid During the Job Application Process.pdfAlliance Jobs
The journey toward landing your dream job can be both exhilarating and nerve-wracking. As you navigate through the intricate web of job applications, interviews, and follow-ups, it’s crucial to steer clear of common pitfalls that could hinder your chances. Let’s delve into some of the most frequent mistakes applicants make during the job application process and explore how you can sidestep them. Plus, we’ll highlight how Alliance Job Search can enhance your local job hunt.
Resumes, Cover Letters, and Applying OnlineBruce Bennett
This webinar showcases resume styles and the elements that go into building your resume. Every job application requires unique skills, and this session will show you how to improve your resume to match the jobs to which you are applying. Additionally, we will discuss cover letters and learn about ideas to include. Every job application requires unique skills so learn ways to give you the best chance of success when applying for a new position. Learn how to take advantage of all the features when uploading a job application to a company’s applicant tracking system.
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...dsnow9802
Jill Pizzola's tenure as Senior Talent Acquisition Partner at THOMSON REUTERS in Marlton, New Jersey, from 2018 to 2023, was marked by innovation and excellence.
1. C programs
1. Program to print text
2.Program To Read Two Numbers And Print The
Sum Of Given Two Numbers.
3.Program To Accept Student Roll No, Marks in 3
Subjects and Calculate Total, Average and Print it.
4.Program To Read Three Numbers And Print The
Biggest Of Given Three Numbers
5.Program To Read A Number And Find Whether
The Given Number Is Even Or Odd.
6.Program to accept a year and check whether the
given year IS leap year or not.
7.Individual Digits
8. Program to accept a three digit number and print
the sum of individual digits.
9. Program to accept a number and check the given
number is Armstrong or not.
10. Program to print ODD numbers from 1 to 10
11. Program to print natural numbers from 1 to 10
in Reverse
12. Program to print sum of the natural numbers
from 1 to 10.
13. Program to accept a number and print
mathematical table of the given no.
14. Program to print 1 to 10 mathematical tables .
15. Program to print fibonacci series .
16. Program to print numeric pyramid
17. Program to print numerical pyramid.
18. Program to print numerical diamond.
19. Program to print character pyramid.
20. Program to print character diamond.
21. Program to find biggest of two no by using
ternary numbers
22. Program to find biggest of four no by using
ternary numbers
2. 23. Program to print smallest of four no by using
ternary operators
24. Program to accept a year and check the given
year is leap or not by using ternary
25. Program to accept a character in the uppercase
and print in lower case.
26. Program to accept a character in any case and
print in another case.
27. Program to natural number from 1 to 10 by
using while loop.
28. Program to accept a string and print it by using
the while loop.
29. Program to accept a string in upper case and
print it by lower case.
30. Program to accept a string in any case and print
it by another case .
31. Program to accept a string print each word in
new line.
32. Program to accept a string and count no of
capital letters, no. of small letters and no. of
special characters
33. Program to accept any single digit number and
print it in words .
34. Program to print prime numbers between 1 to
100
35. Program to accept two numbers and print sum
of two numbers by using functions
36. Program to accept a number and find factorial
of given number
37. Program to accept a number and check the
given number Armstrong or not
38. Program to accept a number and print the sum
of given and Reverse number
39. Program to accept 10 numbers and print first
five numbers in original order and print last five
3. numbers in reverse order.
40. Program to accept a string and print the reverse
of the given string by using for loop.
41. Program to accept a string and check the given
string is palindrome or not .
42.Program to accept values into 3 dimensional
array and print .
43. Program to print upper triangle .
44. Program to accept two 3 dimensional array and
store addition of those into arrays into the third
array .
45. Program to accept a string and find the length
of the given string by using functions
46. Program to count the number of words,
characters, alphabets, vowels, consonants and digit
in a line of text.
47. Program to accept two string and compare the
strings are equal or not
48. Program to sort the entered numbers using
bubble sort.
49. Program to read date,month, year and print the
next day’s date,month,year.
50. Program to interchange two values using
pointers.
51. Program to print “PASCAL TRIANGLE”.
52. Program to check whether a given number is
perfect or not.
53. Program to check whether a given number is
prime number.
54. Program to read ‘n’ number and print them in
matrix terms in all orders.
55. Program to search an element using binary
search
56. Program to accept two numbers and print the
sum of given two numbers by using pointers
4. 57. Programs to multiply two Matrices
58. Program to print prime number between 1-100
59. Program to accept a string and find the length
of the string
60. Program to fibanocci of matrix
61. Program a structure which reads ‘n’ students
information (name,3 subjects marks) and calculate
total marks, result print them in a particular format.
62. Program to find whether a square matrix is a)
symmetric b) skew symmetric c) none of two.
63. Program to find area of a triangle when there
sides are given.
64. Program to print Armstrong number between 1-
500.
65. Program to check whether a given number is
Armstrong or not.
66. Program to print the floyd’s triangle.
67. Program to read data in 3 structures and print
68. Program to print a diagonal matrix.
69. Program to copy contents of one file into
another.
70. Program to create a file of number and copy
odd number into second file and even number into
third file.
71. Program a structure which stores information
about hotels which stores information about name,
grade, room change, no of rooms.
72. Program which does the below process after
reading on odd no of integer.
73. Program to sort the entered elements using
selection sort technique.
74. Program to find whether a number is divisible
by ‘11’ or not without actual division.
75. Program to find maximum and minimum of
entered ’n’ number using arrays.
5. 76. Program to print the following series until there
sum exceeds 2.6 term value exceeds 1.5
x+x2/2!+x3/3!+------------.
77. Program to print a frequency distribution table
for a class of 20-students in the following format.
The marks range form 1-25.
78. Program to accept values into an array and print
array in reverse and original format by using three
different functions.
79. Program to accept values into single
dimensional array and print the array in reverse by
using pointers.
80. Program to read a string and print the number
of characters in each word of the string.
81. Program to accept two strings and compare
those two strings
82. Program to accept a string using pointers and
functions.
83.Program to read a string and print the first two
characters of each word in the string.
84.Program to accept two numbers and print the
sum of given two numbers by using pointers
85.Program to accept a string and print reverse of
the given string by using functions.
86. Program to accept two 3 dimensional array and
store subtraction of those two arrays into third
array..
87.Program to accept a single dimensional array
and print them by using pointers
88.Program to accept two strings and biggest
among them
89.Program to print 4 dimentional matrix with
constant number.
90.Prongram to accept a string and print each word
in reverse
6. 91. Program to accept elements into single
dimensional array and print the array in ascending
order by using three different arrays.
92.Program to accept data and store the given data
into file print the data.
93. Program to accept data in lower case and store
the given data into file into upper case and print the
data.
94.Program to copy contents of one file into
another.
95. Program to create a file of numbers and copy
odd number into second file and even number into
third file
96.Program to accept a string in lower case and
print first character of each word in upper case.
97.Program to accept two numbers and interchange
two values using functions.
98.Program for example of static variable.
99.Program to accept a string and print by trailing
spaces.
100. Program to print anti diagonal.
1. Program to print text
# include <stdio.h>
# include <conio.h>
main()
{
clrscr();
printf(“HELLO WELCOME TO
VIDYARTHI COMPUTERS”);
printf(“Hanamkonda Warangal
phone : 0870-2574900, 9849103344”);
getch();
}
Back
2. Program To Read Two Numbers And Print
7. The Sum Of Given Two Numbers.
# include <stdio.h>
# include <conio.h>
main()
{
int a,b, sum;
clrscr ();
printf (“ENTER VALUE FOR
A ; “);
scanf (“%d”,&a);
printf(“ENTER VALUE FOR
B ;”);
scanf(“%d”,&b);
sum=a+b;
printf(“Sum Of Given Two
Numbers are %d”, sum);
getch();
}
Back
3. Program To Accept Student Roll No, Marks
in 3 Subjects and Calculate Total, Average and
Print it.
# include <stdio.h>
# include <conio.h>
main()
{
int r,b,c,d, tot, avg;
clrscr();
printf (“ENTER STUDENT
RNO ; “);
scanf (“%d”,&r);
printf(“ENTER FIRST
SUBJECT MARKS ;”);
scanf(“%d”,&b);
printf(“ENTER SECOND
8. SUBJECT MARKS;”);
scanf(“%d”,&c);
printf(“ENTER THIRD
SUBJECT MARKS ;”);
scanf(“%d”,&d);
tot=b+c+d;
avg=tot/3;
printf(“nntt VIDYARTHI
COMPUTERS –
HANAMAKONDA nn”);
printf(“t STUDENT RNO ; %d
“,r);
printf(“t FIRST SUBJECT
MARKS ;%d “,b);
printf(“t SECOND SUBJECT
MARKS ;%d “,C);
printf(“t THIRD SUBJECT
MARKS ;%d “,d);
printf(“t AVERAGE MARKS ;
%d”, avg);
getch();
}
Back
4. Program To Read Three Numbers And Print
The Biggest Of Given Three Numbers
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a,b,c,big=0;
clrscr( );
printf(“ENTER VALUE FOR A:”);
scanf(“%d”,&a);
printf(“ENTER VALUE FOR B:”);
scanf(“%d”,&b);
9. print(“ENTER VALUE FOR C:”);
scanf(“%d”,&c);
if (a>big)
big=a ;
if(b>big)
big=b;
if (c>big)
big=c;
printf (“BIGGEST OF ABOVE GIVEN
THREE NUMBER IS %d”,big)
getch( );
}
Back
5. Program To Read A Number And Find
Whether The Given Number Is Even Or Odd.
# include <stdio.h>
# include <conio.h>
main()
{i
nt n,r;
clrscr();
printf(“ENTER A NUMBER ;”);
scanf(“%d”, &n);
r=n%2;
if(r= = 0)
printf(“the above given number is even
number”);
else
printf(“the above given number is odd
number”);
getch();
}
Back
6. Program to accept a year and check whether
the given year IS leap year or not.
10. # include <stdio.h>
# include <conio.h>
main( )
{i
nt y;
clrscr( );
printf(“enter a year:”);
scanf(“%d”,&y);
if(y%4==0& &y%100!=0|| y%400==0);
printf(“the above given year IS a leap
year”);
else
printf(“the above given year IS not a leap
year”);
getch();
}
Back
7. Individual Digits
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a,b,c,d;
clrscr( );
printf ( “ Enter a two digit number :”);
scanf (“ %d”, &a);
b=a/10;
c=a%10;
d=b+c;
printf (“sum of individual digits of given
numbers id %”, d);
getch( );
}
Back
8. Program to accept a three digit number and
11. print the sum of individual digits.
# include <stdio.h>
# include <conio.h>
main( )
{
int a,b,c,n, sum;
clrscr( );
printf (“ Enter a Three Digit Number:“);
scanf (“%d”,&n);
a=n/100;
b=( (n%100)/10);
c=n%10;
sum=a+b+c;
printf (“ Sum of Individual Digits of
Given Numbers is %d”, Sum);
getch( );
}
Back
9. Program to accept a number and check the
given number is Armstrong or not.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt n, a, b, c, d;
clrscr( );
printf (“ Enter a Three Digit Number: “);
scanf (“%d”, &n);
a=n/100;
b=((n/10)%10);
c=n%10;
d=a*a*a*+b*b*b +c*c*c;
if (n= =d)
printf (“The Given Number is Armstrong
number”);
12. else
printf (“The Given Number is Not
Armstrong number”);
getch( );
}
Back
10. Program to print ODD numbers from 1 to
10
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i;
clrscr( );
for (i=1; i<=10; i+=2)
printf(“%dn”,i);
getch( );
}
Back
11. Program to print natural numbers from 1 to
10 in Reverse
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i;
clrscr( );
for (i=10; i>=1; i--)
printf(“%dn”,i);
getch( );
}
Back
12. Program to print sum of the natural
numbers from 1 to 10.
# include <stdio.h>
13. # include <conio.h>
main( )
{int n,sum=0,i;
clrscr( );
for (i=1; i<=10; i++)
sum=sum+i;
printf(“sum of natural numbers from 1 to
10 is %dn”,sum);
getch( );
}
Back
13. Program to accept a number and print
mathematical table of the given no.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,t;
clrscr( );
printf(“which table u want:”);
scanf(“%d”,&t);
for (i=1; i<=10; i++)
printf(“n%d*%d=%d”,t,i,i*t);
getch( );
}
Back
14. Program to print 1 to 10 mathematical tables
.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,j;
clrscr( );
for (i=1; i<=10; i++)
14. for(j=1;j<=10;j++)
printf(“n%d*%d=%d”,i,j,i*j);
getch( );
}
Back
15. Program to print fibonacci series .
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a=0,b=1,c=0,i;
clrscr( );
printf(“%d”,a);
printf(“n%d”,b);
for (i=1; i<=10; i++)
{ c=a+b;
printf(“n%d”,c);
a=b;
b=c;
}
getch( );
}
Back
16. Program to print numeric pyramid
# include <stdio.h>
# include <conio.h>
main()
{i
nt i,j;
clrscr( );
for(i=1;i<=5;i++)
{ for(j=1;j<=i;j++)
printf(“%d”,j);
printf(“n”);
}
15. getch();
}
Back
17. Program to print numerical pyramid.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,j ,l,k=40;
clrscr( );
for(i=1;i<=9;i+=2)
{ for(l=1;l<=k;l++)
printf(“ “ );
for(j=1;j<=i;j++);
printf(“%d”,j);
printf(“n”);
k=k-2;
}
getch( );
}
Back
18. Program to print numerical diamond.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,j,l,n,s,k=40;
clrscr( );
for(i=1;i<=9;i+=2)
{ for(l=1;l<=k;l++)
printf(“ “);
for(j=1;j<=i;j++)
printf(“n”);
k=k-2;
}
16. k=k+4;
for(n=7;n>=1;n-=2)
{ for(i=1;i<=k;i++)
printf(“ “);
for(s=1;s<n;s++)
printf(“%d”,s);
printf(“n”);
k=k+2;
}
getch( );
}
Back
19. Program to print character pyramid.
# include <stdio.h>
# include <conio.h>
main( )
{ char i,j;
clrscr();
for(i=65;i<=70;i++)
{ for(j=65;j<=i;j++)
printf(“%c”,j);
printf(“n”);
}
getch( );
}
Back
20. Program to print character diamond.
# include <stdio.h>
# include <conio.h>
main( )
{ char i,j,n,r;
int s,sp=40;
clrscr( );
for(i=65;i<=75;i+=2)
{ for(s=1;s<=sp;s++)
18. 22. Program to find biggest of four no by using
ternary numbers
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a,b,c,d,big;
clrscr( );
printf(“enter value a”);
scanf(“%d”,&a);
printf(“enter the value of b”);
scanf(“%d”,&b);
printf(“enter the value of c”);
scanf(“%d”,&c);
printf(“enter the value of d”);
scanf(“%d”,&d);
big=(a>b)?(a>c)?(a>d)?a:d:(c>d)?c:d:
(b>c)?(b>d)?b:d:(c>d)?c:d;
printf(“biggest of the given 4 numbers IS
%d”,big);
getch();
}
Back
23. Program to print smallest of four no by
using ternary operators
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a,b,c,d,small;
clrscr( );
printf(“enter value a”);
scanf(“%d”,&a);
printf(“enter the value of b”);
scanf(“%d”,&b);
19. printf(“enter the value of c”);
scanf(“%d”,&c);
printf(“enter the value of d”);
scanf(“%d”,&d);
small=(a<b)?(a<c)?(a<d)?a:d:(c<d)?c:d:
(b<c)?(b<d)?b:d:(c<d)?c:d;
printf(“biggest of the given 4 numbers IS
%d”,small);
getch();
}
Back
24. Program to accept a year and check the
given year is leap or not by using ternary
# include <stdio.h>
# include <conio.h>
main( )
{i
nt y,leap;
clrscr( );
printf(“enter any yr”);
scanf(“%d”,&y);
leap=(y%400= =0)?:(y%100!=0)?(y%4=
=0)?1:0:0;
if(leap= =1)
printf(“ the given year is leap year”);
else
printf(“given year is not leap year);
getch( );
}
Back
25. Program to accept a character in the
uppercase and print in lower case.
# include <stdio.h>
# include <conio.h>
main( )
20. { char ch,c1;
clrscr( );
printf(“enter a cha in uppercase”);
ch=getchar();
c1=ch+32;
printf(“the given char in lowercasecase
is”);
putchar(c1);
getch();
}
Back
26. Program to accept a character in any case
and print in another case.
# include <stdio.h>
# include <conio.h>
main( )
{ char ch,c1;
clrscr( );
printf(“enter a char in anycase”);
ch=getchar();
if(ch>=65 && ch<=90)
c1=ch+32;
else
if(ch>=97 && ch<=122)
c1=ch-32;
printf(“the given char in anothercase IS”);
putchar(c1);
getch();
}
Back
27. Program to natural number from 1 to 10 by
using while loop.
# include <stdio.h>
# include <conio.h>
main( )
21. {
int a=0;
clrscr();
while( a<10)
{
a=a+1;
printf(“%dn”,a);
}
getch();
}
Back
28. Program to accept a string and print it by
using the while loop.
# include <stdio.h>
# include <conio.h>
main( )
{ char ch;
clrscr();
printf(“enter a string”);
while(( ch=getchar( ))!=’n’)
putchar(ch);
getch();
}
Back
29. Program to accept a string in upper case and
print it by lower case.
# include <stdio.h>
# include <conio.h>
main( )
{ char ch,c;
clrscr();
printf(“enter a string in upper case:”);
while(( ch=getchar( ))!=’n’)
{
c=ch+32;
22. putchar(c);
}
printf(“ is in lower case”);
getch( );
}
Back
30. Program to accept a string in any case and
print it by another case .
# include <stdio.h>
# include <conio.h>
main( )
{ char ch;
clrscr( );
printf(“enter a string :”);
while(( ch=getchar( ))!=’n’)
{i
f(ch>=’A’ && ch<=’Z’)
putchar(ch+32);
else
if(ch>=’a’ && ch<=’z’)
putchar(ch-32);
else
putchar(ch);
}
printf(“ is the string”);
getch( );
}
Back
31. Program to accept a string print each word
in new line.
# include <stdio.h>
# include <conio.h>
main( )
{ char ch;
clrscr( );
23. printf(“enter a string :”);
while(( ch=getchar( ))!=’n’)
{
putchar(ch);
if(ch= =’ ‘)
printf(“n”);
}
getch( );
}
Back
32. Program to accept a string and count no of
capital letters, no. of small letters and no. of
special characters
# include <stdio.h>
# include <conio.h>
main( )
{ char ch;
int c=0,s=0,s1=0;
clrscr( );
printf(“enter a string :”);
while(( ch=getchar( ))!=’n’)
{
if(ch>=’A’&& ch>=’Z’)
c=c+1;
else
if(ch>=’a’&& ch>=’z’)
s=s+1;
else
s1=s1+1;
}
printf(“ no of capital letters are %d”,c);
printf(“ no of smal1 letters are %d”,s);
printf(“ no of special characters are
%d”,s1);
getch( );
24. }
Back
33. Program to accept any single digit number
and print it in words .
# include <stdio.h>
# include <conio.h>
main( )
{i
nt n;
clrscr( );
printf(“enter a number :”);
scanf(“%d “,&n);
switch(n)
{
case 0: printf(“ZERO”);
break;
case 1: printf(“ONE”);
break;
case 2: printf(“TWO”);
break;
case 3: printf(“THREE”);
break;
case 4: printf(“FOUR”);
break;
case 5: printf(“FIVE”);
break;
case 6: printf(“SIX”);
break;
case 7: printf(“SEVEN”);
break;
case 8: printf(“EIGHT”);
break;
case 9: printf(“NINE”);
break;
default:
25. printf(“please enter the number between 0
and 9”);
}
getch( );
}
Back
34. Program to print prime numbers between 1
to 100
# include <stdio.h>
# include <conio.h>
main( )
{i
nt n, i, check;
clrscr();
for(i=1;i<=100;i++)
{ check=1;
for(n=2;n<=i/2;n++)
if(i%n= =0)
{ check=0;
break;
}i
f(check= =1)
printf(“n %d is a prime”,i);
else
printf(“n %d is not a prime”,i);
}
getch( );
}
Back
35. Program to accept two numbers and print
sum of two numbers by using functions
# include <stdio.h>
# include <conio.h>
main( )
{i
26. nt a,b,c;
clrscr();
printf(“enter the value for a:”)
scanf(“%d”,&a);
printf(“enter the value for b:”)
scanf(“%d”,&b);
c=add(a,b);
printf(“sum of two numbers is %d”,c);
getch( );
}
int add(int x, int y)
{
int z;
z=x+y;
return z;
}
Back
36. Program to accept a number and find
factorial of given number
# include <stdio.h>
# include <conio.h>
main( )
{i
nt n,f;
clrscr( );
printf(“enter a number:”)
scanf(“%d”,&n);
f= fact(n);
printf(“factorial value is %d”,f);
getch();
}
int fact(int n)
{
int i, fa=1;
for(i=n;i>=1;i--)
27. fa=fa*i;
return fa;
}
Back
37. Program to accept a number and check the
given number Armstrong or not
# include <stdio.h>
# include <conio.h>
main( )
{i
nt n,arm;
clrscr();
printf(“enter any 3 digit number:”)
scanf(“%d”,&n);
arm= armstrong(n);
if(arm= =n)
printf(“%d is Armstrong number”,n);
else
printf(“%d not a Armstrong number”,n);
getch( );
}
int Armstrong (int n)
{
int a,b,c,d;
a=n/100;
b=((n/10)%10);
c=n%10;
d=a*a*a+b*b*b+c*c*c;
return d;
}
Back
38. Program to accept a number and print the
sum of given and Reverse number
# include <stdio.h>
# include <conio.h>
28. main( )
{i
nt a,b,n;
clrscr( );
printf(“enter a number:”)
scanf(“%d”,&n);
a=rev(n);
printf(“REVERSE OF A GIVEN
NUMBER IS %d”,a);
b=add(n,a);
printf(“n sum of a given and reverse
number is %d”,b);
getch( );
}i
nt rev( int n)
{i
nt r,rev=0,s;
while(n>0)
{ r=n%10;
rev=rev*10+r;
n=n/10;
} return rev;
}i
nt add(int n, int a)
{
return n+a;
}
Back
39. Program to accept 10 numbers and print
first five numbers in original order and print
last five numbers in reverse order.
# include <stdio.h>
# include <conio.h>
main( )
{i
29. nt i,a[10];
for(i=0;i<10;i++)
{
printf(“enter value for a[%d]”,i);
scanf(“%d”,&a[i]);
} for(i=0;i<=4;i++)
printf(“nA[%d]=%d”,i,a[i]);
for(i=9;i>=5;i--)
printf(“nA[%d]=%d”,i,a[i]);
getch( );
}
Back
40. Program to accept a string and print the
reverse of the given string by using for loop.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,j;
char name[80];
clrscr( );
printf(“ enter a string”);
gets(name);
for(i=0;i<80 && ((name [i]= getchar())!
=’n’);i++);
if(name[i]= =’n’)
name[i]=’0’;
for(j=i;j>=0;j--)
putchar(name[j]);
printf(“is the reverse of given string”);
getch( );
}
Back
41. Program to accept a string and check
the given string is palindrome or not .
30. # include <stdio.h>
# include <conio.h>
main( )
{i
nt i,lim,c,check=1;
char word[80];
clrscr( );
printf(“ enter a string”);
for(i=0;i<80 && ((word [i]= getchar())!
=’n’);i++);
lim=i-1;
c=lim/2;
for(i=0;i<=0;i++,lim--)
if(word[i]!= word[lim])
{
check=0;
break;
}
if(check= =1)
printf(“the given string is palindrome “);
else
printf(“ not palindrome”);
getch( );
}
Back
42.Program to accept values into 3 dimensional
array and print .
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a[3][3],i,j;
clrscr( );
for(i=0;i<=2;i++)
for(j=0;j<=2;j++)
31. {
printf(“ enter the value for a[%d]
[%d] :”,i,j);
scanf(“%d”,&a[i][j]);
} for(i=0;i<=2;i++)
{ for(j=0;j<=2;j++)
printf(“ %d:”,a[i][j]);
printf(‘n”);
}
getch( );
}
Back
43. Program to print upper triangle .
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a[4][4],i,j,c;
clrscr( );
printf(“ enter which no u want”);
scanf(“%d”,&c);
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(i<j)
a[i][j]=c;
else
a[i][j]=0;
for(i=0;i<4;i++)
for(j=0;j<4;j++)
{
printf(“ %d:”,a[i][j]);
printf(‘n”);
}
getch( );
}
32. Back
44. Program to accept two 3 dimensional array
and store addition of those into arrays into the
third array .
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a[3][3],b[3][3],c[3][3],i,j;
clrscr( );
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
printf(“enter the two values for a[%d]
[%d] & b[%d][%d]”, i,j,i,j);
scanf(“%d%d”,&a[i][j],&b[i][j]);
}
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf(“%d”,c[i][j]);
}
printf(“n”);
}
getch( );
}
Back
45. Program to accept a string and find the
length of the given string by using functions
# include <stdio.h>
# include <conio.h>
int getline(char str[]);
main( )
{ char str[80];
33. int length;
clrscr( );
printf(“ enter a string”);
length=getline(str);
printf(“length of the given string is
%d”,length);
getch ( );
}i
nt getline(char str[])
{i
nt i;
for(i=0;i<80&&((str[i]=getchar( ))!=’n’);
i++);
if(str[i]= =’n’)
str[i]=’0’;
return i;
}
Back
46. Program to count the number of words,
characters, alphabets, vowels, consonants and
digit in a line of text.
#include<stdio.h>
#include<conio.h>
main( )
{i
nt noa=0,nob=0,noc=0,nov=0,now=0,noch=0,l,I;
char ch,s[100];
clrscr( );
printf(“enter 2 lines of text”);
gets(s);
l=strlen(s);
for(i=0;i<1;i++)
{s
witch(s[i])
{ case ‘
34. a’:
case ‘e’:
case ‘i’:
case ‘o’:
case ‘u’:
case ‘A’:
case ‘E’:
case ‘I’:
case ‘O’:
case ‘U’:
nov++;
break;
}i
f(isalpha(s[i]))
noa++;
if(isdigit(s[i]))
nod++;
if(noa[i]==’ ‘) && (noa[i+1]!=’ ‘)
now++;
}
noch=l-nob;
noc=noa-nov;
printf(total no of words %d”,now);
printf(total no of characters(without blanks)
%d”,noch);
printf(total no of characters(including blanks)
%d”,l);
printf(total no of alphabets
%d”,noa);
printf(total no of vowels
%d”,nov);
printf(total no of characters %d”,noc);
printf(total no of digits %d”,nod);
getch( );
}
35. Back
47. Program to accept two string and compare
the strings are equal or not
# include <stdio.h>
# include <conio.h>
int getline (char line[ ], int lim );
int strc(char str1[ ], char str2[] );
main( )
{ char str1[80],str2[80];
int comp;
clrscr( );
printf(“enter first string:”);
getline(str1,80);
printf(“enter second string:”);
getline(str2,80);
comp=strc(str1,str2);
if(comp>0)
printf(“first string is bigger”);
else
if(comp==0)
printf(“both the strings are equal”);
getch( );
}
int getline(char str[], int lin)
{
int i;
for(i=0;i<lin&&((str[i]=getchar())!
=’n’);i++);
if(str[i]=’0’)
return i;
}
int strc(char str1[],char str2[])
{
int i;
for(i=0;str1[i];i++)
36. if(str1[i]!=str2[i])
return str1[i]-str2[i];
return str1[i]-str2[i];
}
Back
48. Program to sort the entered numbers using
bubble sort.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt a[100],i,j,n,t;
clrscr( );
printf(“enter the array size”);
scanf(“%d”,&n);
for(i=1;i<n;i++)
scanf(“%d”,&a[i]);
for(i=1;i<=n;i++)
for(j=i+1;j<n;j++)
if(a[i]>a[j])
{t
=a[i]
a[i]=a[j];
a[j]=t;
}
printf(“the sorted elements are “);
for(i=1;i<=n;i++)
print(“%d”,a[i]);
getch( );
}
Back
49. Program to read date,month, year and print
the next day’s date,month,year.
# include <stdio.h>
# include <conio.h>
37. main( )
{
int
month[12]={31,28,31,30,31,30,31,31,30,3
1,30,31};
int d,m,y,nd,nm,ny,ndays;
clrscr( );
printf(“enter the date,month,year”);
scanf(“%d%d%d”,&d,&m,&y);
ndays=month[m-1];
if(m==2)
{i
f(y%100==0)
{if(y%400==0)
ndays=29;
} else
if(y%4==0)
ndays=29;
}
nd=nd+1;
nm=m;
ny=y;
if(nd>ndays)
{
nd=1;
nm++;
}i
f(nm>12)
{
nm=1;
ny++;
}
printf(“Given date is %d:%d:
%dn”,d,m,y);
printf(“next days date is %d:%d:
38. %d”,nd,nm,ny);
getch( );
}
Back
50. Program to interchange two values using
pointers.
# include <stdio.h>
# include <conio.h>
void interchange(int *x,int *y);
main( )
{i
nt a,b;
clrscr( );
printf(“enter values of a and b”);
scanf(“%d%d”,&a,&b);
interchange(&a,&b);
}
void interchange(x,y)
int *x,*y;
{i
nt t;
t=*x;
*x=*y;
*y=t;
printf(“%d=x, %d=y”,*x,*y);
getch( );
}
Back
51. Program to print “PASCAL TRIANGLE”.
#include<stdio.h>
#include<conio.h>
main()
{i
nt n,p=1,q,num,sp;
clrscr( );
39. printf(“enter the number of rows”);
scanf(“%d”,&n);
for(p=0;p<=n;p++)
{ for(sp=1;sp<=40-(3*p);sp++)
printf(“ “);
for(q=0;q<n;q++)
{i
f((q==q)||(q==0))
num=1;
else
num=num*((q-q)+1)/q;
printf(“%2d”,num);
printf(“n”);
}}
getch( );
}
Back
52. Program to check whether a given number is
perfect or not.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,n,s=0;
clrscr();
printf(“enter the number”);
scanf(“%d”,&n);
for(i=1;i<n/2;i++)
if(n%i==0)
s+=i;
if(s= =n)
printf(“the number is perfect no”);
else
printf(“the number is not perfect “);
getch( );
40. }
Back
53. Program to check whether a given number is
prime number.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,n,c=0;
clrscr( );
printf(“enter a number”);
scanf(“%d”,&n);
for(i=0;i<=n;i++)
if(n%i==0)
c++;
if(c==2)
printf(“given number is a prime number”);
else
printf(“given number is not prime
number”);
getch( );
}
Back
54. Program to read ‘n’ number and print them
in matrix terms in all orders.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,n,c,p,q,r,k,a[20];
clrscr();
printf(“enter the array size”);
scanf(”%d”,&n);
printf(“enter the elements”);
for(i=1;i<=n;i++)
43. # include <conio.h>
main( )
{i
nt a[10][10],b[10][10],c[10],
[10],i,j,m,n,p,q,k;
clrscr( );
printf(“enter the size of first matrices”);
scanf(“%d%d’,&m,&n);
printf(“enter the size of second matrix”);
scanf(“%d%d’,&p,&q);
if(n==p)
{
printf(“enter first matrices elements”);
for(i=1;i<m;i++)
for(j=1;j<n;j++)
scanf(“%d”,&a[i][j]);
printf(“enter second matrix elements”);
for(i=1;i<p;i++)
for(j=1;j<q;j++)
scanf(“%d”,&b[i][j]);
for(i=1;i<m;i++)
for(j=1;j<n;j++)
{ c[i][j]=0;
for(k=1;k<n;k++)
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
printf(“the multiplication matrix is”);
for(i=1;i<m;i++)
{ for(j=1;j<n;j++)
print(“%2d”,c[i][j]);
printf(“n”);
}} else
printf(“multiplication is not possible”);
getch( );
}
44. Back
58. Program to print prime number between 1-
100
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,n,c;
clrscr( );
for(n=1;n<=100;n++)
{ c=0;
for(i=1;i<=n;i++)
if(n%i==0)
c++;
if(c==2)
printf(“n%d”,n);
}
getch( );
}
Back
59. Program to accept a string and find the
length of the string
# include <stdio.h>
# include <conio.h>
main( )
{ char name[80];
int i;
clrscr( );
printf(“enter a string ;”);
for(i=0;i<80&&((name[i]=getchar( ))!
=’n’);i++);
printf(“%d is the size of string”,i);
getch( );
}
Back
45. 60. Program to fibanocci of matrix
# include <stdio.h>
# include <conio.h>
# include <math.h>
main( )
{i
nt a[10][10],i,j,m,n sum=0;
float norm;
clrscr( );
printf(‘enter the matrix size”);
scanf(“%d%d”,&m,&n);
printf(“enter the element of matrix”);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
{s
canf(“%d”,&a[i][j]);
sum=sum+(a[i][j]*a[i][j])
}
norm=sqrt(sum);
printf(“norm=%f”,norm);
getch( );
}
Back
61. Program a structure which reads ‘n’
students information (name,3 subjects marks)
and calculate total marks, result print them in a
particular format.
# include <stdio.h>
# include <conio.h>
main( )
{s
truct student
{ char name[20];
int m1,m2,m3, tot;
char result[10];
46. }stud[10];
int i,n;
clrscr( );
printf(“enter no of students n”);
scanf(“%d”,&n);
for(i=0;i<n;i++)
{
printf(”enter %d student deatails n”,i);
printf(”enter namen”);
scanf(“%s”, stud[i].name);
printf(“enter marks of 3 subjects n”);
scanf(“%d%d%d”,
&stud[i].m1,&stud[i].m2,&stud[i].m3);
stud[i].tot=stud[i].m1+stud[i].m2+stud[i].
m3;
if((stud[i].m1>35)&&(stud[i].m2>35)&&(
stud[i].m3>35))
strcpy(stud[i].result,”pass”);
else
strtcpy(stud[i].result,”fail”);
} clrscr( );
printf(“name total result n”);
for(i=0;i<n;i++)
{
printf(“%s %d %s n”,
stud[i].name,stud[i].tot,stud[i].result);
}
getch( );
}
Back
62. Program to find whether a square matrix is
a) symmetric b) skew symmetric c) none of two.
# include <stdio.h>
# include <conio.h>
main( )
47. {i
nt a[10][10],i,j,m,n,c=0,c1=0;
clrscr( );
printf(“enter the array size”);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
scanf(“%d”,&a[i][j]);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
{i
f(a[i][j]==a[j][i])
c=1;
else
if(a[i][j]==a[j][i])
c1=1;
}
printf(“the given matrix is n”);
for(i=1;i<=m;i++)
{ for(j=1;j<=n;j++)
printf(“%4d”,a[i][j]);
printf(“n”);
}i
f(c==0)
printf(“the given matrix is symmetric”);
else
if(c1==0)
printf(“the matrix is skew symmetric”);
else
printf(“none of two”);
}
getch( );
}
Back
48. 63. Program to find area of a triangle when
there sides are given.
# include <stdio.h>
# include <conio.h>
main( )
{
int a,b,c;
float s, area;
clrscr( );
printf(“enter there sides of the triangle”);
scanf(“%d%d%d”,&a,&b,&c);
if((a+b)<c||(b+c)<a||(a+c)<b)
printf(“finding area is not possible”);
else
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf(“area=%.2f”,area);
getch( );
}
Back
64. Program to print Armstrong number
between 1-500.
#include<stdio.h>
#include <conio.h>
main( )
{i
nt i,n,s,r;
clrscr( );
for(i=1;i<=500;i++)
{
n=i;
s=0;
while(n>0)
{ r=n%10;
s=s+(r*r*r);
49. n=n/10;
}i
f(i==s)
printf(“n%d”,s);
}
getch();
}
Back
65. Program to check whether a given number is
Armstrong or not.
# include <stdio.h>
# include <conio.h>
main( )
{i
nt i,n,s,r,k;
clrscr( );
printf(“enter a number”);
scanf(“%d”,&n);
k=n;
s=0;
while(n>0)
{ r=n%10;
s=s+(r*r*r);
n=n/10;
}if(k==s)
printf(“given number is Armstrong
%d”,k);
else
printf(“given number is not Armstrong
%d”,k);
}
getch();
}
Back
66. Program to print the floyd’s triangle.
50. # include <stdio.h>
# include <conio.h>
main( )
{i
nt i,n,s,r k=1;
clrscr( );
printf(“enter a number of rows”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{ for(s=1;s<=40-i;s++)
printf(“ ”);
for(j=1;j<=i;j++)
printf(“%3d”,k++);
printf(“n”);
}
getch( );
}
Back
67. Program to read data in 3 structures and
print
# include<stdio.h>
# include<conio.h>
main( )
{s
truct book
{ char code;
int piece;
float price;
};
struct book b1,b2,b3;
main( )
{ clrscr( );
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b1.code,&b1.piece,&b1.price);
printf(“enter code,piece,price”);
51. scanf(“%c%d%f”,&b2.code,&b2.piece,&b2.price);
printf(“enter code,piece,price”);
scanf(“%c%d%f”,&b3.code,&b3.piece,&b3.price);
printf(“the details are”);
printf(“n %c%d%f”,b1.code,b1.piece,b1.price);
printf(“n %c%d%f”,b2.code,b2.piece,b2.price);
printf(“n %c%d%f”,b3.code,b3.piece,b3.price);
getch( );
}
Back
68. Program to print a diagonal matrix.
#include<conio.h>
#include<stdio.h>
main()
{i
nt a[4][4],i,j;
clrscr( );
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(i==j)
c[i][j]=7;
else
a[i][j]=0;
for(i=0;i<4;i++)
{ for(j=0;j<4;j++)
printf(“%d”,a[i][j]);
printf(“n”);
}
getch();
}
Back
69. Program to copy contents of one file into
another.
#include<stdio.h>
#include<conio.h>
52. main( )
{
FILE *fp1,*fp2;
char ch;
fp1=fopen(“text1”,”w”);
printf(‘enter the text”);
while((ch=getchar( ))!=EOF)
putc(ch,fp1);
fclose(fp1);
fp1=fopen(“text1”,”r”);
fp2=fopen(“text2”,”w”);
while((ch=getc(fp1))!=EOF)
putc(ch,fp2);
fclose(fp2);
getch( );
}
Back
70. Program to create a file of number and copy
odd number into second file and even number
into third file.
#include<stdio.h>
#include<conio.h>
main( )
{
FILE *fp1,*fp2,*fp3;
int i;
fp1=fopen(“DATA1”,”w”);
printf(“enter the number”);
scanf(“%d”,&i);
while(i!=eof( ))
{
putw(i,fp1);
} fcolse(fp1);
fp1=fopen(“DATA1”,”r”);
fp2=fopen(“DATA2”,”w”);
54. clrscr( );
printf(“enter no. of hotelsn”);
scanf(“%d”,&n);
for(i=0;i<n;i++)
{
printf(“enter name of hotel n”);
scanf(“%s”,&ht[i].name);
printf(“enter name of city n”);
scanf(“%s”,&ht[i].city);
printf(“enter the grade n”);
scanf(“%s”.ht[i].grade);
ht[i].grade=getche( );
printf(“enter room charge n”);
scanf(“%d”,&ht[i].rc);
printf(“enter no of rooms n”);
scanf(“%d”,&ht[i].nr);
} for(i=0;i<n;i++)
for(j=0;j<n-i;j++)
{t
=ht[j];
ht[j]=ht[j+i];
ht[j+1]=t;
}
printf(“enter a grade to print the hotels
n”);
gr=getche();
clrscr();
printf(“hotel name city grade roomcharge
no of room”);
for(i=0;i<n;i++)
if(gr==ht[i].grade)
printf(“%s %s %c %d
%d”,ht[i].name,ht[i].city,ht[i].grade,ht[i].r
c,ht[i].nr);
getch();
55. printf(“enter a room charge to print hotels
less than given charge n”);
scanf(“%d”,&c);
printf(“hotel name city grade roomcharge
no of rooms”);
for(i=0;i<n;i++)
if(c<=ht[i].rc)
printf(“%s %s %c %d
%d”,ht[i].name,ht[i].city,h[i].grade,ht[i].rc
,ht[i].nr);
}
Back
72. Program which does the below process after
reading on odd no of integer.
a) a) Print them in given order.
b) b) Replace second elements by
product of first and last element
c) c) Replace middle value by average of
all elements.
d) d) Replace all –ve no’s by zero’s.
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a[10],i,n,sum=0;
clrscr( );
printf(“enter the array sixe “);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=0;i<n;i++)
{s
canf(“%d”,&a[i]);
sum=sum+a[i];
}
printf(“The given arrays is: “);
56. for(i=0;i<n;i++)
printf(“%d”,a[i]);
a[2]=a[1]*a[n-1];
printf(“n the given areay after replacing
2nd element is”);
for(i=0;i<n;i++)
printf(“%d”,a[i]);
a[(1+n/2)]=sum/n;
printf(“n the given array after replacing
middle element by average of all”);
for(i=0;i<n;i++)
if(a[i]<0)
a[i]=0;
printf(“n given array after replacing –ve
values by zero”);
for(i=0;i<n;i++)
printf(“%d”,a[i]);
printf(“n”);
getch();
}
Back
73. Program to sort the entered elements using
selection sort technique.
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a[100],i,n,j,t,min,pos;
clrscr();
printf(“enter the array size”);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
for(i=0;i<n;i++)
58. a=a/10;
}
while(b>0)
{ evensum=evensum+(b%10);
b=b/10;
}
div=abs(evensum-oddsum);
if(div%11==0)
printf(“The number is divisible by 11”);
else
printf(“The number is not divisible by
11”);
getch();
}
Back
75. Program to find maximum and
minimum of entered ’n’ number using
arrays.
#include<stdio.h>
#include<conio.h>
main( )
{i
nt i,n,a[10],min,max;
clrscr( );
printf(“ enter how many number”);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=0;i<n;i++)
scanf(”%d”,&a[i]);
min=a[0];
for(i=0;i<n;i++)
if(min>a[i])
min=a[i];
printf(“minimum=%d”,min);
max=0;
59. for(i=0;i<n;i++)
if(max<a[i]);
max=a[i];
printf(“n maximum=%d”,max);
getch( );
}
Back
76. Program to print the following series
until there sum exceeds 2.6 term value
exceeds 1.5
x+x2/2!+x3/3!+------------.
#include<stdio.h>
#include<conio.h>
main( )
{ float x,sum=0,prod=1;
int i;
clrscr( );
printf(“enter x value”);
scanf(“%f’,&x);
i=1;
while((sum<2.6)&&(prod<=1.5))
{
prod=prod*(x/i);
if(prod<=1.5)
sum=sum+prod;
if(sum>2.6)
{s
um=sum-prod;
break;
}
printf(“sum=;%f’,sum);
i++;
}
getch( );
}
60. Back
77. Program to print a frequency
distribution table for a class of 20-students
in the following format.
The marks range form 1-25.
class intertval frequency
1.5 1-5
-
6.10 6-10
-
11.15 11-15
-
16.20 16-20
-
21.25 21-25
-
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a[20],i,n1=0,n2=0,n3=0,n4=0,n5=0;
clrscr();
printf(“enter the any 20 no of range(1-
25));
for(i=1;i<=20;i++)
scanf(“%d”,&a[i]);
for(i=1;i<=20;i++)
if((a[i]>=1)&&(a[i]<6))
n1++;
else
if((a[i]>5)&&(a[i]<11))
n2++;
else
if((a[i]>10)&&(a[i]<16))
n3++;
61. else
if((a[i]>15)&&(a[i]<21))
n4++;
else
if((a[i]>20)&&(a[i]<26))
n5++;
printf(“class interval frequency”);
printf(“n 1-5 %d”,n1);
printf(“n 6-10 %d”,n2);
printf(“n 11-15 %d”,n3);
printf(“n 16-20 %d”,n4);
printf(“n 21-25 %d”,n5);
getch();
}
Back
78. Program to accept values into an array and print
array in reverse and original format by using three
different functions.
#include<stdio.h>
#include<conio.h>
void read_array(int x[]);
void print_array(int y[]);
void rev_array(int z[]);
main()
{i
nt a[5];
clrscr();
read_array(a);
printf_array(a);
rev_array(a);
getch( );
}
void read_array(int x[])
{int i;
for(i=0;i<=4;i++)
62. {
printf(“enter values for a[%d]:”,i);
scanf(“%d”,&x[i]);
}}
void print_array(int y[])
{i
nt i;
for(i=0;i<=4;i++)
printf(“%d”,y[i]);
}
void rev_array(int z[])
{i
nt i;
for(i=4;i>=0;i--)
printf(“n%d”,z[i]);
}
Back
79. Program to accept values into single
dimensional array and print the array in reverse
by using pointers.
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a[5],*b,i;
clrscr( );
b=&a[0];
for(i=0;i<=4;i++)
{
printf(“enter a value for a[%d];”.i);
scanf(“%d”,b);
b++;
}
b=&a[4];
for(i=0;i<=4;i++)
63. {
printf(“n%d”,*b);
b-- ;
}
getch( );
}
Back
80. Program to read a string and print the
number of characters in each word of the string.
#include<stdio.h>
#include<conio.h>
#include<string.h>
main( )
{ char s[100];
int i,l,nc=0;
clrscr( );
printf(“enter the sting”);
gets(s);
l=strlen(s);
for(i=0;i<l;i++)
{i
f(s[i]!=’ ‘)
{
nc=0;
while(s[i]!=’ ‘)
{
nc++;
printf(“%c”,s[i]);
i++;
if(s[i]=’0’)
break;
}
printf(“tt %d”,nc);
printf(“n”);
}} getch();
64. }
Back
81. Program to accept two strings and compare
those two strings
#include<stdio.h>
#include<conio.h>
int strcomp (char *pt1, char *pt2);
void read-string(char*pt);
main( )
{ char line [
80],line2[80];
clrscr( );
printf(“enter first string;”);
read-string (line1);
printf(“enter second string”);
read-string(line2);
if(strcomp (line1,line2)>0)
printf(“second string biggest”);
else
if(strcomp (line1,line2)>0)
printf(“ first string biggest;”);
else
printf(“both the strins are equal”);
getch( );
}
void read-string(char*pt)
{ for(;(*pt=getchar( ))!=’n’;pt++);
*pt=’0’;
}i
nt strcomp (char *pt1, char *pt2)
{ for(;*pt1!=’0’;pt1++;pt2++)
if(*pt1!=*pt2)
break;
return *pt1-*pt2;
}
65. Back
82. Program to accept a string using pointers
and functions.
#include<stdio.h>
#include<conio.h>
main( )
{i
nt ch[20];
clrscr ( );
printf(“enter a string”);
read_array(ch);
printf(“%s”,ch);
getch( );
}
void read_string (char*pt)
{ for(;(*pt=getchar( ))!=’/n’;pt++);
*pt=’0’;
}
Back
83.Program to read a string and print the first
two characters of each word in the string.
#include<stdio.h>
#include<conio.h>
main( )
{ char s[100];
int i,l;
clrscr( );
printf(“enter a string”);
gets(s);l=strlen(s);
for(i=0;i<l;i++)
{i
f(s[i]!=’ ‘ && s[i]=’ ‘)
{
printf(“%c %c”,s[i],s[i+1])
i=i+2;
66. while(s[i]!=’ ‘)
i++;
}}
getch( );
}
Back
84.Program to accept two numbers and print
the sum of given two numbers by using pointers
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a, b,c;
clrscr( );
a=10;
b=20;
c=*(&a)+*(&b);
printf(“%d”,c);
getch( );
}
Back
85.Program to accept a string and print reverse
of the given string by using functions.
#include<stdio.h>
#include<stdio.h>
int getline (char str[]);
void printline (char str[],int i);
main( )
{ char str[80];
int 1;
clrscr( );
1=getline(str );
printline(str,1);
printline(str,1);
getch ( );
67. }i
nt getline(char str[])
{i
nt 1;
printf(“enter a string;”);
for(i=0;i<80&&((str[i]=getchar())!=’n’);i++);
if(str[i]=’0’;
return i;
}
void printline(char str[],int 1)
{i
nt j;
for(j=1;j<=0;j--)
printf(“%c”,str[j]);
printf(‘is the revefrse string”);
}
Back
86. Program to accept two 3 dimensional array
and store subtraction of those two arrays into
third array..
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a[3][3],b[3][3],c[3][3],i,j;
clrscr( );
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
printf(“enter two values for a[%d][%d] & b[%d]
[%d]:”,i,j,i,j);
scanf(“%d%d”,&a[i][j],&b[i][j]);
} for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
{ c[i][j]=a[i][j]-b[i][j];
68. printf(“%d”,,c[i][j]);
}
printf(“n”);
}
getch( );
Back
87.Program to accept a single dimensional array
and print them by using pointers
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a[5],*b,i;
clrscr( );
b=&a[0];
for(i=0;i<=4;i++)
{
printf(“enter the a value for a[%d]”,i)
scanf(“%d”,b);
b++;
}
b=&a[0];
for(i=0;i<=4;i++)
{
printf(“n%d”,*b);
b++;
}
getch( );
}
Back
88.Program to accept two strings and biggest
among them
#include<stdio.h>
#include<conio.h>
int getline(char line[],int lim);
69. main( )
{ char str1[80],str2[80];
int len1,len2;
clrscr( );
printf(“enter first string”);
len1=getline(str1,80);
printf(“enter second string”);
len2=getline(str1,80);
if(len1 >len2)
printf(“first string bigger than second string”);
else
if(len1<len2)
printf(“second string bigger than first string”);
else
printf(“both strings are equal”);
getch( );
}i
nt getline(char line[],int lim)
{i
nt i;
for(Ii0;i<lim && ((line[i]=getchar( ))!=’n’);i++)
if(line[i]==’n’)
line[i]=’0’;
return i;
}
Back
89.Program to print 4 dimentional matrix with
constant number.
#include<stdio.h>
#include<conio.h>
main( )
{i
nt a[4][4],i,j,c;
clrscr( );
printf(“enter constant number”);
71. Back
91. Program to accept elements into single
dimensional array and print the array in
ascending order by using three different arrays.
#include<conio.h>
#include<stdio.h>
void read_array(int x[]);
void sort_array(int y[]);
void print_array(int z[]);
main()
{i
nt a[10];
clrscr( );
read_array(a);
sort_array(a);
print_array(a);
getch( );
}
void read_array(int x[])
{i
nt i;
for(i=0;i<10;i++)
{
printf(“enter value for a[%d]”,i);
scanf(“%d”,&x[i]);
}}
void sort_array(int y[])
{i
nt i,j,k;
for(i=0;i<9;i++)
for(j=i+1;j<=9;j++)
if(y[i]>y[j])
{
k=y[i];
y[i]=y[j];
72. y[j]=k;
}}
void print_array(int z[])
{i
nt i;
for(i=0;i<10;i++)
printf(“%dn”,z[i]);
}
Back
92.Program to accept data and store the given
data into file print the data.
#include<conio.h>
#include<stdio.h>
main( )
{
FILE *fp;
char c;
fp=fopen(“data.dat”,”w”);
clrscr();
printf(“enter text”);
while(1)
{ c=getchar( );
if(c==eof( ))
break;
putc(c);
} fclose(fp);
fp=fopen(“data.dat”,”r”);
while(1)
{ c=getc(fp);
if(c==eof( ))
break;
putchar(c);
}
getch( );
fclose(fp);
73. }
Back
93. Program to accept data in lower case and
store the given data into file into upper case and
print the data.
#include<conio.h>
#include<stdio.h>
main( )
{
FILE *fp;
Char c;
fp=fopen(“data2.dat”,”w”);
clrscr( );
printf(“enter text”);
while((c=getchar( ))!=eof( ))
{
putc(toupper(c),fp)
} fclose(fp);
fp=fopen(“data2.dat”,”r”);
while(1)
{ c=getc(fp);
if(c==eof( ))
break;
putchar(c);
}
getch( );
fclose(fp);
}
Back
94.Program to copy contents of one file into
another.
#include<conio.h>
#include<stdio.h>
main( )
{
74. FILE * fp1,*fp2;
char ch;
fp1=fopen(“text1”,”w”);
printf(“enter the text”);
while((ch=getchar()!=EOF);
putc(ch,fp1);
fclose(fp1);
fp1=fopen(“text1”,”r”);
fp2=fopen(“text2”,”w”);
while((ch=getc(fp1))!=EOF)
putc(ch,fp2);
fcolse(fp1);
fcolse(fp2);
getch( );
}
Back
95. Program to create a file of numbers and
copy odd number into second file and even
number into third file
#include<conio.h>
#include<stdio.h>
main( )
{
FILE *fp1,*fp2,*fp3;
int i;
fp1=open(“data1”,w”);
printf(“enter the number”);
scanf(“%d”,&i);
while(i!=eof)
{
putw(i,fp1);
scanf(“%d”,&i);
} fcolse(fp1);
fp1=fopen(“data1”,”r”);
fp2=fopen(“data2”,”w”);
76. for(i=0;i<lim && ((line[i]=getchar( ))!
=’n’);i++);
if(line[i]= =’n’)
line[i]=’0’;
return i;
}
Back
97.Program to accept two numbers and
interchange two values using functions.
#include<conio.h>
#include<stdio.h>
void swap (int a, int b);
main( )
{i
nt a,b;
clrscr( );
printf(“enter value for a;”);
scanf(“%d”,&a);
printf(“enter value for b;”);
scanf(“%d”,&b);
swap(a,b);
getch( );
}
void swap(int a,int b)
}i
nt c;
c=a;
a=b;
b=c;
printf(“na=%d”,a);
printf(“nb=%d”,b);
}
Back
98.Program for example of static variable.
#include<conio.h>
77. #include<stdio.h>
static int i=1;
main( )
{i
nt j;
clrscr( );
for (j=1;j<=5;j++);
fun( );
getch( );
} fun( )
{
printf(“n%d”,i);
i=i+1;
}
Back
99.Program to accept a string and print by
trailing spaces.
#include<conio.h>
#include<stdio.h>
main( )
{ char n,n1;
clrscr ( );
printf(“enter a string;”);
while((n=getchar( )!=’n’)
if(n>=’a’ && n<=’z’)
putchar(n);
else
if(n>=’a’ && n<=’z’)
putchar(n);
getch( );
}
Back
100. Program to print anti diagonal.
#include<conio.h>
#include<stdio.h>
78. main( )
{i
nt a[4][4],i,j,c;
clrscr( );
printf(“enter which number you want;”);
scanf(“%d”,&c);
for(i=0;i<4;i++)
for(j=0;j<4;j++)
if(i+j= =3)
a[i]]j]=c;
else
a[i][j]=0
for(i=0;i<4;i++)
{ for(j=0;j<4;j++)
printf(“%d”,a[i][j]);
printf(“n”);
}
getch( );
}
Back