0% found this document useful (0 votes)
54 views

C/C++ Assignments: Basics

This document lists 24 C/C++ programming assignments covering basic concepts like data types, functions, arrays, file handling, structures, and more. Some examples include writing programs to convert temperatures, calculate variance and standard deviation, simulate a banking application, find Fibonacci numbers, and check for prime numbers. Most involve writing functions to perform calculations, handle user input/output, and manipulate data in arrays or structures.

Uploaded by

Dana Watson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

C/C++ Assignments: Basics

This document lists 24 C/C++ programming assignments covering basic concepts like data types, functions, arrays, file handling, structures, and more. Some examples include writing programs to convert temperatures, calculate variance and standard deviation, simulate a banking application, find Fibonacci numbers, and check for prime numbers. Most involve writing functions to perform calculations, handle user input/output, and manipulate data in arrays or structures.

Uploaded by

Dana Watson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

C/C++ Assignments

Basics
1. Write a program to convert Fahrenheit value to Celsius value.
Formula : C=(F -32)/1.8
2. Write a program to print corresponding ASCII value of a character
3. Write a program to swap values of two variables using function
4. Write a program to print the following output:
1
22
333
4444
55555
****
*
*
****

5. Write a program to print the following table :


P
1000
2000
3000
4000
5000

n
1
2
3
4
5

r
0.1
0.11
0.12
0.13
0.14

SI=P(1+r)n

6. Write programs for the following equations

sin x=x

1+ 12

x 3 x 5 x7
+ .
3! 5 ! 7 !

13 1 4
+ .
3 4

7. Write a program to print electricity bill of a consumer according to the


following schedule.

The minimum charge is Rs. 50 Additional surcharge is 15 % on bill amount


Rs. 300 and above
First 100 units
Next 200 units
Beyond 300 units

60 p per unit
80 p per unit
90 p per unit

8. Write a program to calculate variance and standard deviation


n

1
variance= ( x ix )2
n i=1
std .deviation= variance
n

where

x =

1
x
n i=1 i

9. Write a program with power function, which has two arguments - the
number and the value to which it is to be raised.
If no value for the power is provided, then the default is two.
10.Write a program to Calculate the area of triangle and circle through
overloaded area () function.
Area of triangle =

baseheight
2

Area of circle = r2
11.Write a program to find average of squares of numbers from 1 to 10.
12.Write a program to print direction based on x and y coordinates.

E.g. x = -ve and y = 0 West direction


x = +ve and y = -ve South East direction
x=-ve and y=-ve South West direction

13.Write a program to print Fibonacci number series.


14.Write a program to simulate the banking function of depositing and
withdrawing money from an account.
15.Write a function to copy a string to another string without using strcpy()
function
16.Write a program to print reverse of 2,3,4 or 5 digit numbers
17.Write a program to reverse a line entered by user.
18.Write the program which counts the characters in a line input by user, with
and without spaces.
19.Write a program using switch statement which accepts a number from the
user and prints its corresponding month.
E.g. 1 January; 2 February etc.
20.Write a program to print prime numbers between 50 and 150.
21.Write a program to convert a lower case string to uppercase
22.Write a program to implement employee structure which holds data of 4
employees and displays it.
23.Write a program to write to and read from a file.
24.Write a program to accept 10 values in an integer array. Display the
number of odd, even, and negative numbers.

You might also like