민트맛뚱이
kwangkwang우럭따
민트맛뚱이
전체 방문자
오늘
어제
  • 분류 전체보기 (16)
    • C (12)
    • C programming (2)
    • digital engineering (1)
    • machine learning (0)
    • Data communication (0)
    • signal processing (0)
    • computer architecture (RISC.. (0)
    • project (1)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
민트맛뚱이

kwangkwang우럭따

뚱이가 알려주는 소프트웨어

(C언어) 중간고사 전 과제들
C

(C언어) 중간고사 전 과제들

2022. 12. 17. 21:26

 


# (수정)

Problem1.

1. Declare 4 different types of  constants using both ways: ‘#define’ and other

2. Assign any values on them

3. Print those values vertically and horizontally.

 

Problem2.

1. Declare 2 float  type of variables, assign any values on them.

2. Perform addition, subtraction, multiplication, and divison on values of variables.

3. Print  the results as follows:

Ÿ   Multiplication of  two number:

Ÿ   Division of  two number:

Ÿ   Subtraction of  two number:

Ÿ   Addition of  two number:

 

Problem3

1. Ask user to input two integer numbers. Use scanf() function

2. Perform addition, subtraction, multiplication, and division on two number.

3. Print  the results as follows:

Ÿ   Multiplication of  two number:

Ÿ   Division of  two number:

Ÿ   Subtraction of  two number:

Ÿ   Addition of  two number:

 

Problem4

1. Ask user to input two integer numbers. Use scanf() function.

2. Find the smaller one. Use ternary operator.

 

Problem 5

Ask user enter any integer number. You need to find whether this number is odd or even. Use logical (&&) and arithmetic operator (%).

 

Problem 6 

a, b=10, c=9;

a=++b -++c/3+ ++b*++c;

Find the value of a, b, and c.

 

Problem 7

Input your name using getchar() function in lowercase letters and print them all in uppercase letters using putchar() function. Hint: you can use toupper() function to convert the letters into uppercase

 

Problem 8

Make program using IF STATEMENT that asks user to enter grades of 10 subjects in the scale of 0~100 and categorizes them into A, B, C, F . A is [80;100], B is [60; 80), C is [40; 60), and F is [0; 40). It should print how many user has ‘A’, ‘B’, ‘C’, ‘F’grades and average of the grades.

Example:

Input: 10 20 30 40 50 60 70 80 90 100

Output: You have 3 ‘A’grades, 2 ‘B’grades, 2 ‘C’grades, and 3 ‘F’grades.

                Average of your grades is 55.

 

Problem 9

Make an interactive program using switch statement that ask user weather condition and selects ‘R’ for rainy, ‘H’ for hot, and ‘C’ for cold. If user selects ‘R’ then, recommend user not to forget take umbrella when he/she goes outside. If user selects ‘H’ then, recommend user drink more water. If user selects ‘H’ then, recommend user to drink more water. If user selects ‘C’ then, recommend user to dress warm.

 

Problem 10

Print all odd and event numbers between 1-100 as follows:

Odd        Even

1              2

3              4

5              6

.               .

.               .

99            100

 

Problem 11

Input a name, print it in following forms:

Input: Kim Min Su

Output:

a.

 

K

i

m

 

M

i

n

 

S

u

 

b. KimMinSu

 

Problem 12

Print following two patterns using nested for loop

*****

*****

*****

 

*

**

***

****

 

Problem 13

Make int type of array with the size of 10. Initialize each element of array using scanf() to any value.

a. Print vertically all values of the array.

b. Find the smallest and largest values in array. Print them.

 

Problem 14

Change program 7.2 so that it prints as follows

Group Range Frequency
1 0-20  
2 20-40  
3 40-60  
4 60-80  
5 80-100  

Problem 15

Write a program to input five values and print the following results:

 Example:

Input: 10 5 15 20 25

Output:

Sum of the values 75

Average of the values 15

Smallest of the three 5

 

Problem 16 

Write a program that prints following pattern. Hint: use nesting loop.

******

    *

    *

    *

******

 

Problem 17.

Using two-dimensional array produce following multiplication table. Calculate average and sum row-wise and  column-wise.

 

1 3 5 7 9
3 9 15 21 27
5 15 25 35 45
7 21 35 49 63
9 27 45 63 81
11 33 55 77 99

 

Sum row-wise: 25 75 125 175 225 275

Sum column-wise: 36 108 180 252 324

Average row-wise: 5 15 25 35 45 55

Average column-wise: 6 18 30 42 54

______________________________________________________________________ 1.5 point

Problem 18

Make a program which inputs any name (3 words) and asks user to input two numbers. The first number indicates the name and the second number indicates the letter in that name.

Example:

Input:

Input the name: Hong Gil Dong

Input the numbers: 2 2

Output:

The name you select is Gil

The letter you select in name Gil is i


파이팅!!!~~~~!~!~!!!!!

'C' 카테고리의 다른 글

(C언어) 중간고사 전 과제들 - (3)  (2) 2022.12.17
(C언어) 중간고사 전 과제들 - (2)  (0) 2022.12.17
(C언어) 중간고사 전 과제들 - (1)  (0) 2022.12.17
C언어 공부법  (0) 2022.12.17
software 첫걸음  (0) 2022.12.17
    민트맛뚱이
    민트맛뚱이
    암 벅

    티스토리툴바