Showing posts with label single function. Show all posts
Showing posts with label single function. Show all posts

Scanning a line using scanf function

Problem statement
Write a c program to scan a line using scanf()

Value of pi using basel's equation

Problem statement 
Write a c program to calculate the value of pi*pi/6 using Basel's equation
the equation is pi2/6=1/12+1/22+1/32 and so on  

Converting a floating point number into decimal number

Problem Statement
write a c program to convert a floating point number to integer by multiplying with 10 such that no any zero is remained in the end

Searching an element using Binary Search

Problem Statement
Write a C program to search a element in an array using Binary Search method

Palindrome String

Problem Statement
Write a c program to check weather a sting is palindrome or not

Second Largest Number

Problem Statement
Write a c program to calculate second largest number from entered number,
you should not use any array to store these numbers

Calculating Factors of a Number

Problem Statement
Write a c program to calculate factors of a number
you should take number as an input from user

Printing Pascal Triangle

Problem Statement
Write a c program to print Pascal's triangle
you should take the size of pascal triangle as an input from user
you should use only one array to store the variables

sum of series 1+(1/2)+(1/3)...+(1/n)

Problem Statement
Write a c program to calculate the sum of the series
1+(1/2)+(1/3)...+(1/n)
you should take the value of n as an input from the user

Printing Lucas Numbers

Problem Statement
 Write a program to display the following series(Lucas number)
    2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123.nth term.
 
   Take n as user input. The first two terms of the series are 2 and 1 respectively and remaining terms are the sum of their previous two terms in the series e.g.,
 
    3 = 1+2
    4 = 3+1

Taking Input till one Specific Number is Entered

Problem Statement
write a c program 
which takes input till 0 is entered
once 0 is entered it stops taking input and shows number of input taken

Combination of Money for desired money

Problem Statement
write a c program to first take input from user,then print all the combination of money that can lead to the same sum given by user

Finding Maximum Element in Diagonal of a Metrics

Problem Statement
Write a C program to find out the largest element in the main diagonal and the smallest element in the secondary diagonal in a matrix .

Square Root of any Number using Babylonian Method

Problem statement
Write a c program to calculate square root of any number using Babylonian method 

Printing Ordered Pairs

Problem Statement
Write a C program that reads a positive integer
n and prints all pairs (unordered) of {a,b} so
that
(1/n)=(1/a)+(1/b)

Printing a Metrics in Diagonal Order ass 9

Problem Statement
Write a C program that reads the order N( 20) of a square matrix over data of type
 double. Then it reads the matrix in row-major order in a 2-D array (type double).
 It prints the input data,
 It prints the matrix in diagonal order,
 It prints the matrix in anti-diagonal order, and
It prints the matrix in anti-clockwise spiral order
i.e when the metrics is 
   1 2 3
   4 5 6 
  7 8 9
then  Diagonal order:  7 4 8 1 5 9 2 6 3



Anti-Diagonal order:  1 2 4 3 5 7 6 8 9

Anticlockwise-Spiral order: (odd order matrix) 1, 4, 7, 8, 9, 6, 3, 2, 5
and so on

Calculating Contra-harmonic Mean

Problem Statement
Write a C program that reads a sequence of positive  floating-point numbers from the
keyboard . It computes and finally prints the largest data in the data stream and
the contra harmonic mean of the data. The number of data is is not known a prior.
They are counted while reading. [You are not
allowed to use any array]


Printing Palindrome Number

Problem Statement
Write a c program to take an integer input say n. print out a palindrome of length n
palindrome of length 1:1
palindrome of length2:11

palindrome of length 3:121

palindrome of length 4:1221
palindrome of length 5:12321

Printing a number in reverse order

Problem Statement
Read a decimal integer from the keyboard (It may be negative or positive). Print it in reverse order including its sign

Count of Positive and Negative Numbers Entered

Problem Statement
Write a C program to count how many positive and negative number entered without storing them in any of data storing data types such as array