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
Write a program to print all permutations of a given string.
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
Write the control statements in C language
How many types of arrays are there in c?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
If fflush wont work, what can I use to flush input?
Explain how can I read and write comma-delimited text?
What is stack in c?
Explain how are 16- and 32-bit numbers stored?
Which header file is essential for using strcmp function?
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
What are the loops in c?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What Is The Difference Between Null And Void Pointer?
List the different types of c tokens?