Write a c program using for loop to print typical pattern if
number of rows is entered by keyboard.
ABCBA
AB BA
A A



Write a c program using for loop to print typical pattern if number of rows is entered by keyboard...

Answer / 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

More C Interview Questions

What is the difference between array_name and &array_name?

0 Answers  


print the palindrome numbers in between 0 to n

1 Answers  


Which of the following about the C comments is incorrect ? a.commentscan go over multiple lines b.comments can start any where in the line c.a line can contain comments with out any language statements d.comments can occur within comments

6 Answers   TCS,


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?

0 Answers   KPIT,


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

0 Answers  






What is the purpose of the preprocessor directive error?

0 Answers  


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

1 Answers  


which type of question asked from c / c++ in interview.

2 Answers  


What does %d do?

0 Answers  


Why c is procedure oriented?

0 Answers  


How can you increase the size of a statically allocated array?

0 Answers   TISL,


Stimulate calculator using Switch-case-default statement for two numbers

0 Answers   Wipro,


Categories