Write a program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
Don't use printf statements;use two nested loops instead.
you will have to use braces around the body of the outer
loop if it contains multiple statements.
Answer Posted / rakesh
#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=10;i++){
if(i%2!=0)
printf("*\n");
else{
for(j=0;j<i;j++)
printf("*");
printf("\n");
}
}
return 0;
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What is the process to generate random numbers in c programming language?
What is a macro?
How do I swap bytes?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What are structural members?
What is an endless loop?
How do I determine whether a character is numeric, alphabetic, and so on?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
What math functions are available for integers? For floating point?
What are run-time errors?
Write a program to swap two numbers without using third variable?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
Explain about block scope in c?