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


Please Help Members By Posting Answers For Below Questions

explain what are actual arguments?

830


Explain the array representation of a binary tree in C.

946


Explain what is the difference between null and nul?

884


What are different types of operators?

777


Define Spanning-Tree Protocol (STP)

869


Write a code to generate divisors of an integer?

815


how can f be used for both float and double arguments in printf? Are not they different types?

822


Is there anything like an ifdef for typedefs?

892


Does c have circular shift operators?

965


What is a global variable in c?

775


Why do we use int main instead of void main in c?

897


What does 4d mean in c?

1224


write a program fibonacci series and palindrome program in c

800


Tell me with an example the self-referential structure?

756


What is pass by reference in functions?

534