Free help with homework

Why join Brainly?

  • ask questions about your assignment
  • get answers with explanations
  • find similar questions

Write a c program to calculate card castling ?

example To built a 2 storeys of card castle you need
bottom ( 2 + 2)
Top ( 2 ) + 1 for support
so totally 7 cards.
Similarly write a program to compute the number of cards to build the castle to a given "N" storeys ..
{ with Solution }


int N;                      /*No. of storeys*/
int a,b;                    /*a=No. of standing cards, b= cards for support*/
int T;                       /*Total Cards*/

scanf("%d",&N);       /*Input from user about no. of storeys*/



printf("Cards needed for a %d storeyed castle are %d",N,T);

return 0;
0 0 0
Sample values:
If N=1, T=2; N=2, T=7; N=3, T=15; N=4, T=26
The Brain
  • The Brain
  • Helper
Not sure about the answer?
Learn more with Brainly!
Having trouble with your homework?
Get free help!
  • 80% of questions are answered in under 10 minutes
  • Answers come with explanations, so that you can learn
  • Answer quality is ensured by our experts