By using loops

Reverend Jim commented: Lazy. -3

Recommended Answers

All 3 Replies

Given the lack of details why not?

#include <stdio.h>

int main()
{
    int loops;
    loops = 1 + 2;
    printf("loops is now = %i !", loops);
    return 0;
}
commented: Hah! +15

Why would you need to use a loop to add two numbers?

commented: I used loops. +15

My guess is it's one of those pointless intro exercises, like "add two numbers using only bitwise operations" that some professors think will teach you something useful. The only thing it teaches is how to do something in the least efficient possible way.

commented: I really should have used numbers that have the digit 2 in them. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.