What's new

Need Help for C programming :)

My advice for you will be to write code on paper first, just use pen/pencil and paper. It increases your dependability on your own brain rather than on a compiler, which ultimately makes your brain a compiler. You can easily erase, strike through or amend your code on a paper better than on a computer screen. A paper also gives you space to see the results in run time (You will understand it once you start writing code on a paper).
Once on a computer, your brain already starts depending on compiler, which slows down you brain and learning becomes harder, try P/PP i mean Pen/Pencil Paper coding, i think it will help you a lot. I know from my experience.

thanks for the advice, i will try this. For now im stuck again and this time on a paper task for a pseudocode. But this time its more mathematical problem for me i think.
 
thanks for the advice, i will try this. For now im stuck again and this time on a paper task for a pseudocode. But this time its more mathematical problem for me i think.

Sub PrimeFactor(n)
While n % 2 == 0
Print n
n /= 2
EndWhile
For i = 3 To SquareRoot(n) Step 2
While n % i == 0
Print i
n /= i
EndWhile
EndFor
If n > 2 Then
Print n
EndIf
EndSub

This is how i used to write pseudo codes...
 
thanks for the advice, i will try this. For now im stuck again and this time on a paper task for a pseudocode. But this time its more mathematical problem for me i think.

Yup, Pseudocode is going to help you understand the flow, but don't confuse my suggestion with it. Along with Pseudocode you should also try to write compiler ready programs on paper as well.
 
Or just throw an exception if anything else than a positive integer is put in during input since the modulo already takes care of decimal places.
C doesn't have exceptions :lol:
 
C doesn't have exceptions :lol:
We are not talking about software exceptions which you throw and catch. Rather an exception to the normal running of the program.

A bit of context done by reading the history of what is being talked about would helped you avoid a pointless smiley.
 
We are not talking about software exceptions which you throw and catch. Rather an exception to the normal running of the program.

A bit of context done by reading the history of what is being talked about would helped you avoid a pointless smiley.

How do you think any developer would interpret "throw an exception"?
 
Hi guys, I am right now a cs stud
Mate, if you want to study CS , need to sharpen logical thinking and analysis part. Writing code is the easiest part once you have the logic. Assignments are given to hone your logical analysis skills.

But this time its more mathematical problem for me i think.
you need pretty good mathematical concepts in CS for analyzing runtime of your code.
 
How do you think any developer would interpret "throw an exception"?
On context. We referred to assembly pipeline errors as exceptions and embedded c++ exceptions and the same.
Throwing an exception is just a term I am used to. Would it behove your strict standards to accept if I said "create a numerical exception"?
 

Pakistan Affairs Latest Posts

Back
Top Bottom