Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
553 B
1
Indexable
Never
#include <stdio.h>
#include <stdlib.h>

int main()
{

    int startingNum,timesToDouble,total;

    printf(" Enter first number you want to start doubling : ");
    scanf("%d",&startingNum);

    printf(" Enter how many times you want to double : ");
    scanf("%d",&timesToDouble);



    for( int i = 1; i <= timesToDouble; i++) {

         startingNum = startingNum * 2;
         total += startingNum;

        printf(" %d \n",startingNum);

    }


    printf("\nTotal value of all %d\n",total);



    return 0;

}