Write a c program using for loop to print typical pattern if
number of rows is entered by keyboard.
ABCBA
AB BA
A A
Answer Posted / a.jayashree
#include<stdio.h>
#include<string.h>
main()
{
char a[5];
int i=0,j=0;
printf("enter the string");
scanf("%s",a);
printf("\n%s",a);
for(i=0;i<a[5];i++)
{
if(a[i]==a[2])
{
printf("\n\t");
}
else
{
printf("%s",a);
}
}
for(j=0;j<a[5];j++)
{
if(a[j]==a[1])
{
if(a[j]==a[2])
{
if(a[j]==a[3])
{
printf("\n\t\t\t");
}
else
{
printf("%s",a);
}
}
}
}
}
Is This Answer Correct ? | 2 Yes | 6 No |
Post New Answer View All Answers
explain what are actual arguments?
Explain the array representation of a binary tree in C.
Explain what is the difference between null and nul?
What are different types of operators?
Define Spanning-Tree Protocol (STP)
Write a code to generate divisors of an integer?
how can f be used for both float and double arguments in printf? Are not they different types?
Is there anything like an ifdef for typedefs?
Does c have circular shift operators?
What is a global variable in c?
Why do we use int main instead of void main in c?
What does 4d mean in c?
write a program fibonacci series and palindrome program in c
Tell me with an example the self-referential structure?
What is pass by reference in functions?