29
KALPIT G. SONI B.Sc. M.C.A. 2-Gurukrupa Society. B/h Shantinagar Society. N.K.Road

Informatics C

Embed Size (px)

Citation preview

Page 1: Informatics C

KALPIT G. SONIB.Sc. M.C.A.2-Gurukrupa Society.B/h Shantinagar Society.N.K.RoadNadiad – 387 001Phone No. : 0268-2520731 ( R. )

9898230909 ( M. )Email id : [email protected]

* * * * * * * * * * * *

Page 2: Informatics C

Basic Programs.* * * * * * * * * * * *

Write a Program for the following output.Informatics.

Output : Informatics Nadiad.

Output : InformaticsNadiad.

Output : Informatics

Nadiad.

Output : Informatics Nadiad.

Write a Program to draw Rectangle.

Write a Program to Print Address.

Write a Program to print Address in Rectangle.

Write a Program to print Swastik.

Write a Program to explain Comment in C.

Write a Program to explain Data Types.

Write a Program to read one number and display it.

Write a Program to read one number and display it with message.

Write a Program to find power(x,y)

Write a Program to explain math function.

Write a Program to display ASCII value of given character.

Write a Program to display character of given ASCII value.

Write a Program to add two numbers.

Write a Program to multiply two numbers.

Page 3: Informatics C

Write a program to perform all arithmetic operators ( + , - , * , / , % )

Write a program to find month and day of total days.

Write a Program to interchange two values using third variable.

Write a Program to interchange two values without using three variables.

Write a Program to find area of a Rectangle. : ( Area = l * b )

Write a Program to find volume of a Cube. : ( Volume = l * b * h )

Write a Program to find area of Triangle. : ( Area = b * h *0.5 )

Write a Program to calculate area of Circle. : ( Area = Pi * r * r )

Write a Program to calculate simple interest : ( S.I. = ( p * r * n ) / 100 )

Write a Program to compute centigrade to Fahrenheit ( F = 1.8 * c + 32 )

Write a Program to computer Fahrenheit to centigrade. ( C = (F-32)/1.8 )

A company has following scheme for payment t their staff. Net Salary = Gross Salary – Deduction.Gross Salary = Basic + DA + HRA + Medical.Deduction = Insurance + PF.

DA : 50 % of BasicHRA : 10 % of BasicMedical : 4 % of BasicPF : 5 % of Gross.Insurance : 7 % of Gross.

Write a Program to calculate net payment to any employee.

Read the price of item in decimal form. Ex. 12.50 and separate Rs and Price from the given value. Ex. 12 Rupees and 50 Paise.

* * * * * * * * * * * *

Page 4: Informatics C

Conditional Programs ( if, if-else, if-else ladder, Switch-case, goto ,continue)

* * * * * * * * * * * *

Write a Program to read marks of a student from keyboard whether the student is pass.

Write a Program to read marks of a student from keyboard whether the student is pass or fail.

To check whether the given number is odd or even.

Write a Program to read number from keyboard whether it is positive.

To check whether the given number is positive or negative.

To check whether the given number is positive, negative or zero.

To check whether the given number is one-digited, two-digited, three-digited or more than three digited.

To check whether the given number is perfect square or not.

To check whether the given year is leap year or not. A leap year is a year which is evenly divisible by 4,but if it is evenly divisible by 100 then it is not a leap year, but if it is evenly divisibly by 400 then it is a leap year.

To check whether the given character is Alphabetic or a digit or a special character.

To check whether the given character is in Uppercase or in Lowercase.

To check whether the given number is divisible by 5 or not.

Write a Program to find average of two numbers.

Write a Program to find maximum number out of two numbers.

Page 5: Informatics C

Write a Program to find minimum number out of two numbers.

Write a Program to find maximum number out of three numbers.

Write a Program to find minimum number out of three numbers.

Write a Program to find middle number out of three numbers.

Write a Program to read marks from keyboard and your Program should display equivalent grade according to following table.

Marks Grade100 – 80 Distinction60 – 79 First Class35 – 59 Second Class0 – 34 Fail

Write a Program that reads a number from 1 to 7 and according should display Monday to Sunday ( Using Switch-case )

Write a Program that reads a number from 1 to 7 and according should display Monday to Sunday ( Using if-else )

Write a Program that reads a number from 1 to 12 and according should display January to December. ( Using Switch-case )

Write a Program that reads a number from 1 to 12 and according should display January to December. ( Using Switch-case )

Make a Simple Calculator ( Using if…else if )

Make a Simple Calculator ( Using Switch-case )

A function f is defined as follows :

F ( x ) : ax3 – bx2 + cx – d if ( x > k )

: -ax3 + bx2 – cx + d if ( x < k )

Page 6: Informatics C

: 0 if ( x =k )

* * * * * * * * * * * *Loops* * * * * * * * * * * *

Print the series : 1 2 3 4 5 6 7 8 9 10

Print the series : 1 2 3 4 ……….N

Print the series : 10 9 8 7 6 5 4 3 2 1

Print the series : 1 4 7 10

Print the series : 1 4 9 16 25 36

Print the series : 35 24 15 8 3 0

To calculate the sum of first 10 natural numbers.

To calculate the sum of first N Natural numbers.

To calculate the sum of even numbers between 1 to 10.

To calculate the sum of even numbers between 1 to N.

To calculate the sum of odd numbers between 1 to 10.

To calculate the sum of odd numbers between 1 to N.

To calculate the average of even numbers between 1 to 10.

To calculate the average of even numbers between 1 to N.

To calculate the average of odd numbers between 1 to 10.

To calculate the average of odd numbers between 1 to N.

To read any five numbers and print the average value.

Write a Program to find out all the numbers divisible by 5 and 7 between 1 to 100.

Find out sum of digits of given number. Ex. 4567 : 4 + 5 + 6 + 7 : 22

Page 7: Informatics C

Find out sum of digits of given number until the number becomes single digit.Ex. 4567 : 4 + 5 + 6 + 7 : 22 : 2 + 2 : 4

Print Multiplication table for a given number

Write a Program to find factor of a given number.

Print Multiplication table for 1*1 to N*N.

Write a Program to find the factorial of a given number.

Write a Program to find Reverse of a given number

Find out sum of first and last digit of a given number

To check the given number is palindrome or not. ( 1221 )

To check the given number is Armstrong or not.Ex. : 153 : 1 + 125 +27 = 153

To check the given number is Prime or not.

Consider a currency system in which there are notes of seven denominations, namely Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 20, Rs. 50, Rs. 100. A sum of Rs. N is entered through keyboard. Write a function to compute the smallest number of notes that will combine to give Rs. N.

Find out the Armstrong number between 1 to N.

Find out the Prime number between 1 to N.

To find the sum of first N prime numbers.

To find the value of the following formula.nCr = n! / ( r! * ( n – r ) ! )

to find the value of the following formula.nPr = n! / ( n – r )!

Write a Program to find out largest digit in an given integer.Ex. 4562 : Largest Number is 6

Page 8: Informatics C

Check whether the given number is perfect of not. A number is perfect if its sum of digits is same as multiplication of digits. ( Ex. 123 : 1 * 2 * 3 = 1 + 2 + 3 )

Write a Program to find greatest common divisor ( GCD ) for two positive integer numbers. ( Ex. 15 and 45 Ans : 15 )

Write a Program to find out least common multiplier ( LCM ) from two positive integer numbers.

To check whether the given number is binary or not.

To check whether the given number is octal or not.

Series :

1 + 2 + 3 + . . . . . + n

2 + 4 + 6 + . . . . . + n

1 + 3 + 5 + . . . . . + n

1 + 4 – 9 + 16 – 25 + 36. . . . . + n2

1! + 2! + 3! + 4! + . . . . . + n!

1/1! + 1/2! + 1/3! + . . . . . + 1/n!

x + x^2 + x^3 + x^4 + . . . . . + x^n.

1 + 2 +4 + 8 + 16 + 32 + . . . . . n terms.

1 + ¼ + 1/9 + 1/16 + . . . . . n terms

Write a Program to calculate Fibonacis series no 1 1 2 3 5 8 . . . . . .

Print first 50 odd numbers. Note that Program should display only five numbers per line.

Patterns.

* * * ** * * ** * * ** * * *

Page 9: Informatics C

* * * *

** ** * ** * * ** * * * *

** *

* * ** * * *

* * * * *

* * * * ** * * ** * ** **

* * * * ** * * *

* * ** *

*

11 21 2 31 2 3 41 2 3 4 5

12 1

3 2 14 3 2 1

5. 4 3 2 1

1 2 3 4 51 2 3 41 2 31 2

Page 10: Informatics C

1

5 4 3 2 14 3 2 13 2 12 11

12 23 3 34 4 4 45 5 5 5 5

12 2

3 3 34 4 4 4

5 5 5 5 5

5 5 5 5 54 4 4 43 3 32 21

5 5 5 5 54 4 4 4

3 3 32 2

1

$$ $$ $ $$ $ $ $

11 01 0 11 0 1 01 0 1 0 1

10 1

Page 11: Informatics C

1 0 10 1 0 1

1 0 1 0 1

1 0 1 0 11 0 1 01 0 11 01

1 0 1 0 10 1 0 1

1 0 10 1

1

10 01 1 10 0 0 01 1 1 1 1

10 0

1 1 10 0 0 0

1 1 1 1 1

1 1 1 1 10 0 0 01 1 10 01

1 1 1 1 10 0 0 0

1 1 10 0

1

12 34 5 67 8 9 1011 12 13 14 15

Page 12: Informatics C

13 2

6 5 410 9 8 7

15 14 13 12 11

11 12 13 14 157 8 9 104 5 62 31

15 14 13 12 1110 9 8 7

6 5 43 2

1

5 4 3 2 14 3 2 13 2 12 11

1 2 3 4 51 2 3 41 2 31 21

55 45 4 35 4 3 25 4 3 2 1

11 41 4 91 4 9 161 4 9 16 25

1

Page 13: Informatics C

2 23 3 3

4 4 4 45 5 5 5 5

** *

* * ** * * *

* * * * *

* * * * ** * * *

* * ** *

*

54 4

3 3 32 2 2 2

1 1 1 1 1

AA BA B CA B C DA B C D E

A B C D EB C D E

C D ED E

E

AA B

A B CA B C D

A B C D E

aa ba b ca b c d

Page 14: Informatics C

a b c d e

aa b

a b ca b c d

a b c d e

a b c d ea b c d

a b ca b

a

ZZ Y

Z Y XZ Y X W

Z Y X W V

** *

* * ** * * *

* * * * ** * * *

* * ** *

*

* * * * ** ** ** ** ** * * * *

** * * ** * * * * ** * * * * * * ** * * * * * * *

Page 15: Informatics C

01 0 1

2 1 0 1 23 2 1 0 1 2 3

4 3 2 1 0 1 2 3 4

0-1 0 1

-2 -1 0 1 2-3 -2 -1 0 1 2 3

-4 -3 -2 -1 0 1 2 3 4

* * * * * * * * * * * *Array* * * * * * * * * * * *

Write a Program to Print any five numbers using 1 – D.

Write a Program to accept Five numbers from keyboard and display it.

Write a Program to accept N numbers and display it.

Write a Program to accept N numbers and display it in reverse order.

Write a Program to print sum of any 10 numbers.

Write a Program to find Maximum element from 1 – D array.

Write a Program to find Minimum element from 1 – D array.

Write a Program to find total Positive elements from 1 – D Array.

Write a Program to print all Positive elements from 1 – D Array.

Write a Program to find total Negative elements from 1 – D Array.

Write a Program to print all Negative elements from 1 – D Array.

Write a Program to find total zero elements from 1 – D Array.

Write a Program to find total odd elements from 1 – D Array.

Page 16: Informatics C

Write a Program to display all odd elements from 1 – D Array.

Write a Program to find total even elements from 1 – D Array.

Write a Program to display all even elements from 1 – D Array.

Write a Program to sort given array in ascending order.

Write a Program to sort given array in descending order.

Write a Program to check that the given elements is present in the list or not.

Program : Selection Sort

Program : Bubble Sort

…………Program : Binary Search

Accept 1 – D Array A and B. Which are sorted in ascending order. Write a Program to merge them into 1 – D Array C that contains all elements from array A & B, in ascending order.

Write a Program to find out the addition of two matrix.

Write a Program to find out the subtraction of two matrix.

Write a Program to find out the Multiplication of two matrix.

……….Write a Program to insert an element in 1 – D Array at specific location.

Write a Program to delete an element from 1 – D Array.

Write a Program to remove duplicate elements from keyboard.

Write a Program to count number of positive, negative and zero elements from 3 * 3 matrix.

Pascal Traingle.

A square matrix having same number of rows and columns is called diagonal matrix, if its only non-zero elements are on the diagonal from upper left to lower right. It is called upper triangular. If all elements below the major diagonal are zero and lower triangular is all elements above the diagonal are zero.

Page 17: Informatics C

Write a Program that read a matrix and determines if it is one of three special matrices.

Suppress all zero elements at the bottom of array.

Suppress all negative elements at the bottom of the array.

Suppress all positive elements at the bottom of the array.

Suppress all non-zero elements at the bottom of the array.

……………Write a Program to check for Symmetrical square matrix or not.

Ex. 1 2 3 Ex. 1 2 32 4 5 2 4 53 5 8 3 5 8

To convert the given decimal number into its equivalent binary number.

To convert the given binary number into its equivalent decimal number.

To convert the given decimal number into its equivalent octal number.

To convert the given octal number into its equivalent decimal number.

To convert the decimal number into its equivalent Hexadecimal number.

To convert the Hexadecimal number into its equivalent decimal Number.

* * * * * * * * * * * *Strings Example* * * * * * * * * * * *

Write a Program to display string on the screen.

Write a Program to accept the string from the keyboard and display it.

Write a Program to find the length of the string.

Page 18: Informatics C

Write a Program to print the string in reverse order.

Write a Program to find total words in given string

Write a Program to find total space in given string.

Write a Program to find total vowels in given string using if…else

Write a Program to find total vowels in given string using Switch-case.

Write a Program to find particular vowels in given string using if…else

Write a Program to find particular vowels in given string using Switch-case.

Read a string through the keyboard. Write a Program to print character by character with the ascii code.

Write a Program to find particular character from the given string.

Write a Program to replace character.

Write a Program to delete character.

Write a Program to convert the string in Upper caseInformatics : INFORMATICS.

Write a Program to convert the string in Lower case.

Informatics : informatics.

Write a Program to convert the string in Reverse Case.

KALPIT soni : kalpit SONI.

Write a Program to convert the string in Sentence case.

INFORMATICS COMPUTER : Informatics Computer.

Write a Program to convert the string in Toggle Case.Informatics Computer : iNFORMATICS cOMPUTER

Page 19: Informatics C

Write a Program to find out the string is palindrome or not.

Write a Program to append the string.

Write a Program to insert a word in the given string.

Write a Program to find a given word in a string.

Write a Program to delete a given word from a given string.

Write a Program to replace a given word from a given string.

Write a Program to explain String Copy Function.

Write a Program to explain String Cat Function.

Write a Program to check that both string are equal or not. ( Using Function )

Write a Program to check that both string are equal or not.

Write a Program to String compare case-sensitive.

Write a Program to String compare case-Insensitive.

Write a Program calculate the total number of capital, small and special character from array.

Write a Program to arrange the string character in ascending order.

Write a Program to arrange the string character in descending order.

Write a Program to arrange the strings in Ascending order.

Write a Program to arrange the Strings in Descending order.

Suppress all capital letters at the bottom of the array.

I II N N II N D D N II N D I I D N I

Page 20: Informatics C

I N D I A I D N I

Write a Program to perform following output.INFORMATICS COMPUTER INSTITUTE.

SCITAMROFNI RETUPMOC ETUTITSNI.

* * * * * * * * * * * *Function.* * * * * * * * * * * *

Write a Program to sum of two numbers without arguments.

Write a Program to sum of two numbers with arguments with no return values.

Write a Program to sum of two numbers with arguments and with return values.

Write a Program to perform arithmetic function using function using Switch-case.

Write a Program to find maximum of two numbers using function.

Write a Program to find minimum of two numbers using function.

Write a Program to find maximum of three numbers using function.

Write a Program to find minimum of three numbers using function.

Write a Program to check that the given number is palindrome or not using function.

Write a Program to check that the given number is Armstrong or not using function.

Write a Program to check that the given number is Prime or not using function.

Write a Program to add first n numbers.

Write a Program to find out average of first n numbers.

Page 21: Informatics C

Write a Program to find the factorial of a given number using function.

Write a Program to find the factorial of a given number using function using Recursive function.

Write a Program to interchange values of two variables using function.

Write a Program which return 1 if the number is prime otherwise return 0.

Write a Program which return 1 if the number is palindrome otherwise return 0.

Write a Program to ding greatest common divisor ( GCD ) for two positive integer numbers.

Write a Program which prints binary equivalent of any decimal number using function.

Write a Program which prints decimal equivalent of any binary number using function.

Write a Program which prints octal number of any decimal number using function.

Write a Program which prints decimal number of any octal number using function.

Write a Program which print hexadecimal number of any decimal number using function.

Write a Program which print decimal number of any hexadecimal number using function.

Write a function power(x,y)

Write a Program to find factor of a given number.

Write a Program to accept 5 elements and display it using function.

Write a Program to accept n elements and display it using function.

Write a Program to accept elements and display for 2-D.

Page 22: Informatics C

Write a Program to sort the elements in Ascending order.

Write a Program to find Maximum number from array elements using Return Function.

Write a Program to explain function in function.

Write a Program to display string.

Write a Program to display string in reverse.

Consider a currency system in which there are notes of seven denominations, namely Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 20, Rs. 50, Rs. 100. A sum of Rs. N is entered through keyboard. Write a function to compute the smallest number of notes that will combine to give Rs. N. using function.

* * * * * * * * * * * *Structure* * * * * * * * * * * *

Write a Program to initialization structure. ( 1st Method )

Write a Program to initialization structure. ( 2nd Method )

Write a Program to initialization structure. ( More than one object )

Write a Program to initialization of multiple structure.

Write a Program for array within structure.

Write a Program for structure within array.

Write a Program searching an item from array of structure.

Write a Program to sorting elements of array of structure.

Write a Program to explain nesting of structure.

Write a Program to accept Roll No., Name and 3 subject marks and display result and grade using structure.

* * * * * * * * * * * *

Page 23: Informatics C

Pointer.* * * * * * * * * * * *

Write a Program to print the addresses of variables.

Write a Program accessing elements using pointer.

Write a Program changing elements using pointer.

Write a Program to accept elements of 1 – D Array using pointer.

Write a Program to accept elements of 2 – D Array using pointer.

Write a Program to ascending 1 – D Array using pointer.

Write a Program to find particular elements in 1 – D array using pointer.

Write a Program to find particular elements in 2 – D array using pointer.

* * * * * * * * * * * *File Management.* * * * * * * * * * * *

Write a Program writing a string ( Character by character ) into a file.

Write a Program reading a String ( Character by character ) from a file.

Write a Program to read n integer numbers from keyboard and stored in Oddeven.txt File. From this file separate all even integers in Even.txt File and stored all Odd integers in Odd.txt File.

Write a Program two files data1 and data2 contains stored list of integers. Generate third file that holds a single sorted, merged list of the two files.