C Exercice Help

Hey Jow Forums it's my first time posting here so no bully.

Im a C newbie and I'm doing exercices to improve, I don't know if it's supposed to be this complicated or Im just too low IQ to be able to study computer science.

I have to write a function (With no pointers, printf or arrays allowed) whose execution will give me :

00 01, 00 02, 00 03, 00 04, 00 05, ..., 00 99, 01 02, ..., 97 99, 98 99$

Ive coded this thus far but the 01 02 bit is wrong. Give it to me straight Jow Forums am I a brainlet ?

Attached: Bad Code.png (1920x1080, 203K)

for(int i=0;i

No, this looks fine for a beginner. But why are you setting c = '2'; instead of c = '0'?

Well the exercice seems to ask that when 00 99 gets incremented it gives you 01 02 directly which I dont know how to get.
Otherwise the rest seem ok

Attached: Screenshot from 2018-05-18 20-42-01.png (1920x1080, 369K)

you can have ABCD as integers and printing '0' + integer
Or you can have it as single number and printing n/1000, (n/100)%10, (n/10)%100, n%10 (with ^). This will simplify the logic a lot.

This either seem overly complicated or im not smart enough to see the genius behind it

aChar = i + '0';

instead

It seems a lot of people use the modulo yet I dont seem to follow how it is used in this case

To get specific digit from decimal denotation. Let's say you have n=333633 and want to get the third lowest digit (6), n/100 == 3336, 3336%10 == 6
so to get x-th digit the formula would be ( n / 10^(x-1) ) % 10

also mistake in my comment, there should be (n/10)%10

for( int i = 0; i

are you sure that theres not an error in the exercise? seems weird to make one of them off like that

Wow that's pretty cool ! But in my code I used char instead of int so I don't know if it would work. Still it seems like a very useful trick thank you so much

I have wondered that myself but It is the way its written in it.

Ask your professor/assistant.

Attached: 2.png (1251x800, 200K)

maybe something like this, but it ends with an extra ", " #include
int main(){
for(char a = '0' ; a

NO BULLY !

Thats a neat way of doing it but c has to be 8 at the end

#include

int main()
{
for(int i = 0;i

oh i realized i didn't read the question at all, haha.

Just tested it. It looks similar but its not right

for(int i = 0; i < 99; ++i)
{
for(j = i + 1; j < 100; ++j
{
std::cout

> but its not right
Not only you're retarded but also blind

>Piscine
Hon hon hon

this

just do something like
str_right(strcat('000', strcat(src, iter)), 4)

>inb4 string
why deprecate yourself with the no pointer bs