DEV Community

Kartik Kumar
Kartik Kumar

Posted on • Updated on

cs50X week1 C

.
In the second week I developed new skills like logic building and much more. Started with the c language basic things like ---

  • variables,
  • datatypes,
  • operators [arithmetic, logical, relational and ternary] ,
  • functions,
  • loops,
  • conditionals [If-else and switch].

I learned how to approach problem :

  • First understand the problem thoroughly
  • Take pen and paper, spend some time on writing pseudo code for that problem.
  • Think how to implement that in program.
  • Start with small steps. You cannot think all the solution of problem before writing code. You must start writing code and then the problems start coming so as the ideas to solve them.
  • I have to focus more on understanding loops , if-else while giving conditions. Sometimes I get confused what the expression actually mean here.

Lastly but most most important:

  • design50 taught me to write the code effectively[use abstraction, comments for future, break tasks into small functions, keep main function clean].
  • style50 taught me to write code so it look neat and clean.
  • check50 taught me to test my code with different inputs and conditions.
  • cs50.ai and cs50.dev was very helpful throughout this all.

Problem sets:
1) Hello, world = Very easy, just print "Hello world".
2) Hello, It’s Me = getting name input and printing hello [name]
3) mario-less = Printed right aligned pyramid
4) mario-more = Printed left + right aligned pyramid
5) cash = According to the american currency, we have to tell how many coins will be returned by seeing the change owed.
6) credit = This was very time taking but interesting and taught how the credit card numbers are actually has a mathematical relation between them.

Top comments (0)