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 can you assign a different address to an array tag?

648


What are the types of bitwise operator?

667


What are the 5 types of inheritance in c ++?

589


Can you please explain the difference between syntax vs logical error?

699


In c language can we compile a program without main() function?

584






Why use int main instead of void main?

601


Explain how do you search data in a data file using random access method?

700


Distinguish between actual and formal arguments.

593


What is malloc return c?

603


How can this be legal c?

656


Why is main function so important?

619


What are the application of void data type in c?

722


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

735


Explain the difference between #include "..." And #include <...> In c?

635


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

764