0

May i have code in C to get above pattern as my output if i give 4 as input(number of lines)?

1 333 55555 7777777

15th Sep 2016, 3:56 PM
VISHAL V
VISHAL V - avatar
5 odpowiedzi
+ 2
#include <stdio.h> int main() { int n,i,j,a=1; scanf("%d",&n); for(i=1;i<=n;i++) { for(j=1;j<=a;j++) { printf("%d",a); } printf("\n"); a +=2; } return 0; } here you go :)
16th Sep 2016, 6:38 AM
Mosiur Rahman
Mosiur Rahman - avatar
+ 2
thankyou i got it 👌
15th Sep 2016, 5:53 PM
Abhishek Narwal
Abhishek Narwal - avatar
+ 2
i'll try,btw thanks for this question
15th Sep 2016, 5:54 PM
Abhishek Narwal
Abhishek Narwal - avatar
+ 1
what does 4 as input(number of line means)? can u explain?
15th Sep 2016, 5:32 PM
Abhishek Narwal
Abhishek Narwal - avatar
+ 1
@abhishek_if i give input 2 i should get 1 333 for i/p 3, o/p can be 1 333 55555 which indicates it has to print upto 3rd odd number. code which is independent of input is also ok for me.but i have to get above pattern as output.
15th Sep 2016, 5:50 PM
VISHAL V
VISHAL V - avatar