programming language 1 - wordpress.com · programming language 1 functions pointer array string...

Post on 02-Aug-2020

18 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

PROGRAMMING LANGUAGE 1

FUNCTIONS

POINTER

ARRAY

STRING

STRUCTURE

AMERICAN INTERNATIONAL UNIVERSITY- BANGLADESH where leaders are created

CSC-1102

Course name:

Course code:

BASIC C

NORMAL PROGRAMS

IF-ELSE STATEMENTS

LOOP

PATTERN PRINTING

CODES OF WHOLE SEMESTER FROM CLASSES -----------------------------------------------------

----------------------------------------------------- VERSION: 1.OO

TOPICS

Solution by: JUBAYER, SADAT (17-*****-2)

Released on 25th august, 2017

All codes are Checked and Compiled by

Feel free to contact me if you have any problem or query

EMAIL sadatjubayer@gmail.com

FACEBOOK Fb.me/SadatJubayer

LinkedIn linkedin.com/in/sadatjubayer/

GITHUB Github.com/SadatJubayer

SADAT JUBAYER

Special THANKS to our respected faculty:

SHAHRIN CHOWDHURY Three free Advices Hai, Lena hai toh Lo, Nahi toh Jaane do..!

Don’t memorize codes, try to understand the concept. Type codes by your own hand instead of copy-pasting.

Learn coding to become a Programmer, not for getting A+ on the exams.

Basic C-Programming

*Printing Hello World

*Printing Hello World (in separate lines)

Solution by: JUBAYER, SADAT PAGE NO. 01

*Take a number from keyboard and print that

*Take two number as input and print the sum of the numbers

Solution by: JUBAYER, SADAT PAGE NO. 02

*Multiplication of two integer and two float numbers

*a and b as integer, c and d as float. Find- (a+b)/(c+d)

Solution by: JUBAYER, SADAT PAGE NO. 03

*Swapping two integer numbers

*Celsius to Fahrenheit conversion

Solution by: JUBAYER, SADAT PAGE NO. 04

*Take 3 integer numbers as input and print their reverse number

*Take 5 integer numbers as input and print their reverse number

Solution by: JUBAYER, SADAT PAGE NO. 05

*Take 5 subjects’ marks as input and find the sum of marks

*KG to Pound conversion

Solution by: JUBAYER, SADAT PAGE NO. 06

*Take 5 Digit number as input and find the sum of the Digits

Solution by: JUBAYER, SADAT PAGE NO. 07

If-else statements

*Take year as input, if it’s bigger than 25, print ‘bonus 2500’ else print

‘No bonus’

*Check Even number or Odd number

Solution by: JUBAYER, SADAT PAGE NO. 08

*Finding youngest one form three people’s age

Solution by: JUBAYER, SADAT PAGE NO. 09

*Checking eligibility of Joining Army

Recruitment for male Recruitment for female

Age: 18 to 21

Height: 5.5+

Weight: 50+

Marital status: Single

Age: 18 to 21

Height: 5.2+

Weight: 45+

Marital status: Single

Solution by: JUBAYER, SADAT PAGE NO. 10

*Checking worker efficiency form working hours

In a company, worker efficiency is determined on the basis of the time required for a worker to complete a particular job. If the time taken by the worker is between 2 – 3 hours, then the worker is said to be highly efficient. If the time required by the worker is between 3 – 4 hours, then the worker is ordered to improve speed. If the time taken is between 4 – 5 hours, the worker is given training to improve his speed, and if the time taken by the worker is more than 5 hours, then the worker has to leave the company. If the time taken by the worker is input through the keyboard, find the efficiency of the worker.

Solution by: JUBAYER, SADAT PAGE NO. 11

*Checking year: Leap year or not

*Checking year: Leap year or not (using logical operator)

Solution by: JUBAYER, SADAT PAGE NO. 12

*Checking Letter: Vowel/Consonant

Solution by: JUBAYER, SADAT PAGE NO. 13

LOOP

*Sum of 1 to 100 (using loop)

*Sum of odd numbers between 1 to 100 (using loop)

Solution by: JUBAYER, SADAT PAGE NO. 14

*Sum of even numbers between 1 to 100 (using loop)

*15 employees, if extra hour is more than 40 will get 600 per extra

hour, otherwise no bonus.

Solution by: JUBAYER, SADAT PAGE NO. 15

*Factorial of a Number

*Checking number: Prime number or Not

Solution by: JUBAYER, SADAT PAGE NO. 16

*Print prime numbers (1 to 100)

Solution by: JUBAYER, SADAT PAGE NO. 17

*Finding out Fibonacci Numbers:

*Checking number: Palindrome or not

Solution by: JUBAYER, SADAT PAGE NO. 18

PYRAMID PRINTING

*Printing this:

Number of Line N=3

*

* *

* * *

Number of Line N=5

*

* *

* * *

* * * * * * * * *

Solution by: JUBAYER, SADAT PAGE NO. 19

*Printing this:

Number of Line N=3

* * *

* *

*

Number of Line N=5

* * * * *

* * * *

* * * * *

*

Solution by: JUBAYER, SADAT PAGE NO. 20

*Printing this:

Number of Line N=3

1

1 2

1 2 3

Number of Line N=5

1

1 2

1 2 3 1 2 3 4 1 2 3 4 5

Solution by: JUBAYER, SADAT PAGE NO. 21

*Printing this:

Number of Line N=3

1 2 3

1 2

1

Number of Line N=5

1 2 3 4 5

1 2 3 4

1 2 3 2 2

1

Solution by: JUBAYER, SADAT PAGE NO. 22

MORE PATTERNS

*Printing this:

Number of Line N=3

1 1 2 1

1 2 3 2 1

Number of Line N=4

1 1 2 1

1 2 3 2 1

1 2 3 4 3 2 1

Solution by: JUBAYER, SADAT PAGE NO. 23

*Printing this:

Number of Line N=3

1 1 2 3

1 2 3 4 5

Number of Line N=4

1 1 2 3

1 2 3 4 5

1 2 3 4 5 6 7

Solution by: JUBAYER, SADAT PAGE NO. 24

*Printing this: (Floyd’s Triangle)

Number of Line N=3

1 2 3 4

5 6 7 8 9

Number of Line N=4

1 2 3 4

5 6 7 8 9

10 11 12 13 14 15 16

Solution by: JUBAYER, SADAT PAGE NO. 25

*Printing this:

Number of Line N=3

1

3 2 1

4 3 2 1

Number of Line N=4

1

3 2 1

4 3 2 1

5 4 3 2 1

Solution by: JUBAYER, SADAT PAGE NO. 26

Functions

*Summation, Subtraction, Multiply, Division using Function

Solution by: JUBAYER, SADAT PAGE NO. 27

*Printing Patterns (using Function)

Solution by: JUBAYER, SADAT PAGE NO. 28

*Finding bonus from extra working hours (using function)

Solution by: JUBAYER, SADAT PAGE NO. 29

*Palindrome or not (using Function)

Solution by: JUBAYER, SADAT PAGE NO. 30

*Swapping number using function

Solution by: JUBAYER, SADAT PAGE NO. 31

Pointer

*Swapping using pointer

Solution by: JUBAYER, SADAT PAGE NO. 32

*Output of *, &, ** , *(*), &(*)

Output:

Solution by: JUBAYER, SADAT PAGE NO. 33

*Finding Radius using pointer

Solution by: JUBAYER, SADAT PAGE NO. 34

*Palindrome or not using function and Pointer

Solution by: JUBAYER, SADAT PAGE NO. 35

*Checking Index using Pointer

Solution by: JUBAYER, SADAT PAGE NO. 36

Array

*Finding maximum, minimum and delete

Solution by: JUBAYER, SADAT PAGE NO. 37

*Finding maximum, minimum and difference of them

Solution by: JUBAYER, SADAT PAGE NO. 38

*Finding a Number from Array [1D array]

Solution by: JUBAYER, SADAT PAGE NO. 39

*Finding a number from 2D array

Solution by: JUBAYER, SADAT PAGE NO. 40

*Separate even and odd numbers from 2D array

Solution by: JUBAYER, SADAT PAGE NO. 41

*Number deletion from Array

Solution by: JUBAYER, SADAT PAGE NO. 42

*Finding number and replace from Array

Solution by: JUBAYER, SADAT PAGE NO. 43

*Take 10 elements from keyboard and add 7 to each element and print

the result

Solution by: JUBAYER, SADAT PAGE NO. 44

String

String Copy:

String Compare:

Solution by: JUBAYER, SADAT PAGE NO. 45

String Compare (Limited):

String Length:

Solution by: JUBAYER, SADAT PAGE NO. 46

String Concat:

String Reverse:

Solution by: JUBAYER, SADAT PAGE NO. 47

Normal Codes and Function Codes of Strings

**Strncpy**

Normal Format

Function Format

Solution by: JUBAYER, SADAT PAGE NO. 48

**Strlen**

Normal Format

Function Format

Solution by: JUBAYER, SADAT PAGE NO. 49

**Strcmp**

Normal Format

Function Format

Solution by: JUBAYER, SADAT PAGE NO. 50

**Strrev**

Normal Format

Function Format

Solution by: JUBAYER, SADAT PAGE NO. 51

**Concat**

Normal Format

Function Format

Solution by: JUBAYER, SADAT PAGE NO. 52

*Output Finding: 1

Solution by: JUBAYER, SADAT PAGE NO. 53

*Output Finding: 2

Solution by: JUBAYER, SADAT PAGE NO. 54

Structure

Normal scan-print

Scan-print using structure

Solution by: JUBAYER, SADAT PAGE NO. 55

* Student’s name, department, course, roll and joying year as input &

Printing Name of the students who joined 2017(Using structure)

Solution by: JUBAYER, SADAT PAGE NO. 56

* 8 Student’s name, department, course, roll and joying year, marks as

Input & Printing Name of the students who joined 2017 and also print

Average mark of the students (Using structure)

Solution by: JUBAYER, SADAT PAGE NO. 57

*Print-Scan using Nested Structure

Solution by: JUBAYER, SADAT PAGE NO. 58

*Nested structure (Finding Output)

Output:

Sadat 01754422008 Dhaka 1122

Solution by: JUBAYER, SADAT PAGE NO. 59

Value and Pointer on Structure

Solution by: JUBAYER, SADAT PAGE NO. 60

Recursion

--- End ---

Solution by: JUBAYER, SADAT PAGE NO. 61

Ye To Bas Shuruaat Hai

Picture Abhi Baaki Hai!

Programming Language 2 is

coming on next semester with C++

top related