C Exercise - Learning by Doing | Saran Siri | Skillshare

C Exercise - Learning by Doing

Saran Siri, Instructor

C Exercise - Learning by Doing

Saran Siri, Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
6 Lessons (55m)
    • 1. C Exercise - Introduction

      0:41
    • 2. C Exercise - Input/Output

      13:33
    • 3. C Exercise - Condition

      13:12
    • 4. C Exercise - Loop

      11:12
    • 5. C Exercise - Function

      9:17
    • 6. C Exercise - Array

      6:53
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

123

Students

--

Projects

About This Class

Hello everyone, my name is Saran.

Welcome to C Exercise! ...studying the theory is never enough to be good at programming. In this course, we will go through a lot of examples. We will cover all common mistakes in C programming. You can use online compiler like onlinegdb.com

In each video, I will provide questions and let you pause and work on them. The solution will be given after breaks. Learning this way will help you understand the concepts faster than reading the textbook.

Enjoy the class!
Saran Siri

Meet Your Teacher

Teacher Profile Image

Saran Siri

Instructor

Teacher

Will you please follow me because you will love watching my new classes I publish?

Learning code from fun exercises is the best way to start with. I've spent all my free-time making courses like these. If you like highly edited videos, feel free to follow me for more to come.

Do you have Skillshare Premium?

Skillshare Premium is required to watch most of my courses because it gives me the chance to earn money based on every minute you spend watching. I have a Skillshare Premium subscription that gives me unlimited access to all Skillshare courses free for the first month and then $96 a year after that which is just $8 per month! This is how I prefer to take online courses because I complete payment once and then I am able to lear... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. C Exercise - Introduction: Hello with one. My name is Iran. Welcome to see exercise Study. The theory is never enough to be good at programming, and this course we will go through a lot of examples. River Coverall. Common mistakes in C programming you can use on like a pyre er like online. Ddb dot com. Let's get started. Go to online TDP dot com on the language. See, then click Run. David chose her logo on the bottom of the screen. You're good to go. 2. C Exercise - Input/Output: So when you get start, it should print out into H and because I should stop here waiting for user to type it in examples 10 without tight 10 and hit Enter. It shouldn't went out. Um, I am 10 years old. What should I write here? No bruise. We need to create a variable to star h gonna be Etch as an end. Then you will print out into H to let the user know that I want age. Then the next line should be stand f to receive the input and started inside each last time would be to print I am 10 years old so it's gonna be a blank. Yes, old and replace blank with h That's it. That's one. I want to get two variables selected. Typing a A and B, for example, Age five. Easton, your friend out the some off A and B Yes. Five question is 15 the first line with you to create two rebels To start these into a and be then freak out and your okay, scan it and store the 1st 1 inside. Very go a do the same thing for for be skin of senti No and the first line should be the sun off endears blank with some off a And he is like And what should be The blank should be a plus B, right? Return zero. So what if I want to find the area off the rectangle and rick tango with the with off five eyes off three. So use every inter by here, and then you ask the height wishes three. And if you print out and we're is 15 so the phone lines should be area is with times I No way. We need to create variables to stall with an ICT Oh, used int with and been owned. And with stand it started inside with. Then you have And you're right. Then what? Then we print out area is blank and the blank should be what with times. All right, return, Joe. But if I don't wonder rectangle I want to find the area off triangle like this. So it has the same with five. It has the same right miss years, right? So the formula for the series 1/2 times with times like should be 7.5, right? So the only thing you need to change is here. You have to change it. To what? One of the two times with times, right? Is that it? No. Because you get here right here. Why us? One is in two. Isn't 1/2 it's gonna be in. It's not gonna be 0.5, right? It was zero. So you have to change it to 0.5. Or are you could do like one divided by 20 Something like that. Or 140 d went by 2.0. You have to change either this one or this one to be a double and also changed its part. Bumpus indeed to within F. So if you enter radius up one, I want to define the area off circle. High times are square and development of this fear is full over three pi r Cubed use double for the radius double radius, Enter radius again If listen out Medias then we print out of the area. First area off circle IHS length on the blank should be What should be pi over used 3.14 times are which is radius times radius again. Joan Oh, Spear is link. What is the blank to be four or with three right for over three What zero times? 3.14 times Radios three times That's radios, signs, radius return. Darryl. But what you said the time Remember balls, for example, is, uh, for you. So 40 is what? It's more than three. There are more than three dozens of balls. I didn't know that. So three dozen is what, three times 12 36 spot and thirties, rid of arable to store in them by the balls. Oh, use just no story it's and day and then friended there here more then length those. And so both. How do we find three. Does is about off 40. Well, if you print out for over three who gets one right? Even print out for 40 over 12 we'll get what? Three. So we use the emitters that India What about in his end to simply Jeff? He doesn't. So this cash None. Do you want it by 12. Return zero. Don't forget that 3. C Exercise - Condition: and put the age like anti and then based on the age. If they're just read it and 60 three notes, you are old. If it's not, do nothing in this birth. Do nothing. But if I run it again and type in 55 to print out you old No thank you In which out into each of then check if h is better than 60. It is true Ukraine hours You are old now You fishing the question a little bit. It is not rather than 60 it is less than or equal to 60 Print out You are young. That means she should print out. You are young to I think this part We'll have another years, right? It is great And 60 we know you're old If h is less than or equal to 60 you're young, you are you know But because at 60 where is greater than 60 You're old here that's an equal to you're young It is not greater than 60. It is less than or you couldn't 60 we can use else because combining both cases you get the seamless line You see the gender on the user You said that I don't type mm as a corrector, or if full male and female and then if you're so type in em as male, just print out you are now. If you said type in other collectors like nine, you should point out era. I show another kiss when gender is. If you should point out you are female now we use collector gender in here. We asked him gender because collector and it is true between out what you are male if it's not. But if Gender IHS instead if then we print out you are female, that's far else. It is not true on both cases. Then we print out era return zero. So I have a box and I want to put two lessons into the box. It at him has weight. This one has when a 50 another one has 1 50 So the total weight ISS defendant the program received two ways. Buy them together and ask if the total weight spreader than or equal 2000 it is greater than or you could 1000 then train out the box. It's having it is not went out the box. It's like and in this case to print out the box is like we have two barrels. Wait one in bed, too, and overuse W one and W two print out into weight. One scan. It started inside W one. The one done. We ask if combining two together w one plus w two. It's credit and you go to 1000. It is true. Repent So the back IHS Evan, it is not. Find out the box. Yes, like does it write a book? Em that received a score and received the total score. For example, Scoring seven Total score is 20. Then calculate the great. It is greater than or you go to 80%. This case 7/20 is 35%. It was greater than 80% were print out Excellent. If it's brilliantly too gift of the sun good, it's less than 50%. But in this case is poor. You have to available us again, score and Toto score. Then, after receiving them, I'll use another variable to calculate the percentage sh so the same fish time for scarred by divided the score. The problem here that scores inch and total score. Yeah, it's the result from using the division you would get just another end, right? So you could somehow change it. Maybe at 1.0 in front of the score. That way, When? 1.0 times seven. You get 70 Yes, P, which is the percentage discredit down or you go to 80% Wishes zero p. H. We got a friend out. Excellent. It is not, but still greater than a week to 50% Been out. Get otherwise you're doing poor. 4. C Exercise - Loop: Let's do y Lou. I sprained out. I'd be one Heidi too. 93 i before Until seven. You can use four you can use while this matter, I'll be used while the first starting with creating invariable one while I still less than or equal to seven print outs. I be And for Cindy does it with it goes up by one, we turn. Cheryl, you could do the same thing with follow with a Follow me. I think I four i he goes one unless than you could seven. I think it is that one. Then break out I d s and D and i something. Now this print out Stunning form 4321 Bill I wonder is to So the starting point is four, right? It goes down and stop at minutes to so I should be greater than or you two minutes to And every time it turns out then do me it goes down. Serving on followed started four true one to bring us to and it goes down and written on Lee. The number? Yes, we have 5 10 lifting Tony 35 starting 0.5. It is at 35 goes up by what? By five. So I'm gonna ride the starting point. Stunning for use five. While I is less Daniel, you could to 35 I, but as a defense, I I goes up by five. It is a decimal number, right? So we will use double that 0.2. While de is less than or equal to 1.2. Print out this number and then he goes up by what? 0.2 that form one and with one in 28 does that by what times to oh, use for Eco's one I last and we go to 128 I times a equals to Richman's I egos I times to straight out. I return zero one Space Bar seven to Space Bar six three Space Spa, 54 for by three 6 to 71 He's just this part quick. Way to do it is to create two barrels. One starts form one, the other ones that for seven well, one goes up by one another. One goes down by one until it hits seven. So while one of them, for example, I it's less than or you to seven print out Cendy Space Bar isn't D. This leads I under one state. Then we're gonna update both of them. I goes up that one I plus plus and J goes down by one. Or you can just use one variable. I would you only decide 12 people find seven while I was less than equal to seven and then every now it's it's endgame cendy. This seven comes for H minutes one sick transform eight minutes to age minutes three is five, eight miners, four is for So I could just use I for the first part and then used eight minutes. I I with us return zero. This is the tricky one. We have won 11 then 111. It's very TK was the different between 1 11 10 and then what? 100 I'm done 1000 10,000. One of their 1000. You use the previous number for the people's line times 10 and plus one. So the pupils number is one times 10. It's 10 plus one. It's 11. It uses the people's one again 11 times 10. Both one wanted in 11 so this party's wanted it 11 times 10 plus one 1000 wanted in so the full ways. If in it goes. If in this one time stent, let's one. Yeah, and I Eco's one, while eyes less than Nico, too. 111111 created offer, then PBA's one times 10 plus one and then put it back to the next one. 5. C Exercise - Function: into a and to be say, 5 10 and it should print out some IHS 15 but this time favorable. A. And you should go into the function so great a function in some and has to primitives A and B and then inside the main function, you should call some put in five and 10 here, and it should return out. 15. No stunning with writing the D function So returning the sun between and beach the return A plus B and then we can call the main function. Follow with man function, read to vegetables into a skinner and to be so in here. Other create another variable to store the sun between and be and call the function passed A and B into it. It's a five and 10 goes here is will get 15 and returned 15 to here, then ever print out. As as a result, that's some IHS. This received the number from being put, for example, minutes to and then find the answer to battle the absolute value off masters too. Absolute value off 15 years. 15 No. 0.3. It's zero by three. We've used the function boy name is print that's and freed out the absolute value up in no stunning with writing the method name and the perimeter. So if any minute as to what the pie by minutes one. So in kids off and less time zero print the absolute better blank Yes, link. This blank is just in. 2nd 1 is any times that's one. Yes, just drink the same value in and no return. It would be called farm main function. You call it here received two barriers and then three. Now the higher value in this case 5.9 is greater than five for H. So print out 5.9. You should create a function called Max that it has to privatise in one and into so if and one is black with H into its 59 we could check this by asking is in one great and to it is granted and into me the return. And while it is not, that means into discredit it in one so just returned and to And then we will call it from the main function. Oh, this potion Max and pass and one and into in into an inter jury in then print out the some off 1 to 5. So December wanted by is one plus two plus three was four or five, which is 15 is the in is 10. It should be one plus two plus three all the way to 10. We just 55 so creative function. Return to some and call it some of bin it receives on a one parameter. We need a valuable to go from 1 to 5. The car time stops on one everything out of the valuable to collect all the summation, we'll call it some start from zero then with the use of Allah, it goes long one and to And then along the way we collected and put it into some and it goes up by one. Then return the summation to some off one to blank if blank and the first blank is and 2nd 1 is this method some off and put an end 6. C Exercise - Array: So I've seen your name Jimmy. And then my name is Jimmy. So you received the string or shot array story and then trade out. First reality created Variable the store Jimmy to be in a and let's say the name is not longer than 20 collectors. Then we print out your name static and then traded my name IHS Link so it would be replaced within me. We've received a number of students, and after that we asked for scores. But student stood in one score. Let's say a seven score 65 91 and then into students. You can either into 12 or three, they say into three. Then it would pull out the students. Three. Score score is 91. That means you will need to store all the scores in inch array. No, thank you. Let's start with credit. The valuable to store the site off the array. Its size printouts number on students scan. It did after we know the science of the Arabize in creating a rate and scores array the size of this, these realize come form the fallen start with an I four. I Eco's still eyes less than the size I plus plus. Then we will print out student length. Score it in with I plus one that the youth again if story at score I After that, we asked you, sir to type in the student number can create another valuable to star this number. So the student three we pull up the score form student at two stood in blank score. Yes, blank 1st 1 should be whatever it is inside day this number comes form score at J minus one 60 did number for example 365142 Spring out there Reverse version of this number should be to 41563 No, thank you. Thus we look at It s a sharp array. It started with creating an I d that can store six collectors. Bring out i d and then scan it. Then there's the use by group Go for right to left and then print each of them. But first we need to print out reverse I d follow with the wild It I should start from in the five goes all the way to zero i d apt. Hi. It goes down by one