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
Is int a keyword in c?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Explain why c is faster than c++?
Explain how many levels deep can include files be nested?
Explain what is the difference between far and near ?
What is a pointer in c plus plus?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
Explain what are preprocessor directives?
What does node * mean?
What is the use of getchar functions?
Linked lists -- can you tell me how to check whether a linked list is circular?
What is declaration and definition in c?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
Is this program statement valid? INT = 10.50;
What is the difference between array and pointer?