Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(int argc, char const *argv[]) {
- int start;
- int *ptr = &start;
- int total = 0;
- printf("how many numbers would you like to add: ");
- scanf("%d", &start);
- for (size_t i = 0; i < start; i++) {
- ptr++;
- printf("please enter a number: ");
- scanf("%d", ptr);
- total+=*ptr;
- }
- printf("total is %d\n", total);
- return 0;
- }
Advertisement