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 value of a[3] if integer a[] = {5,4,3,2,1}?

0 Answers  


Is exit(status) truly equivalent to returning the same status from main?

0 Answers  


Can math operations be performed on a void pointer?

0 Answers  


What is page thrashing?

0 Answers  


What is f'n in math?

0 Answers  






write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

0 Answers   Subex,


What are the uses of pre-processor directives?

2 Answers  


how would a 4*3 array A[4][3] stored in Row Major Order?

0 Answers   HCL, Ignou,


String concatenation

2 Answers  


Is main is a keyword in c?

0 Answers  


wat is the difference between array and pointer?

4 Answers   Wipro,


main() { float a=3.2e40; printf("%d",a); }

9 Answers   Satyam,


Categories