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 can you assign a different address to an array tag?
What are the types of bitwise operator?
What are the 5 types of inheritance in c ++?
Can you please explain the difference between syntax vs logical error?
In c language can we compile a program without main() function?
Why use int main instead of void main?
Explain how do you search data in a data file using random access method?
Distinguish between actual and formal arguments.
What is malloc return c?
How can this be legal c?
Why is main function so important?
What are the application of void data type in c?
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
Explain the difference between #include "..." And #include <...> In c?
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