Wipro
Company
Programming
Program
write a code to print the following pattern
1*2*3*4*17*18*19*20
--5*6*7*14*15*16
---8*9*12*13
----10*11
the - in the left should necessarily be printed
Read Solution (Total 18)
-
(no subject)
Vineet Sharma
to me
33 minutes agoDetails
#include
using namespace std;
int main() {
int n;
cin>>n;
int a = 1;
int c = n*(n+1)/2;
int b = c*2;
int k = b-n;
k++;
for(int i=n; i>0; i--) {
int s = k - i + 1;
for(int j=0;j- 9 years agoHelpfull: Yes(40) No(14)
- /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
int n = 4 , l = 1 , r = 20;
for(int i=0;i - 9 years agoHelpfull: Yes(10) No(6)
- #include
#include
void main()
{
int a=1,n,b,i=0,j,p=3,z,r,t,q;
clrscr();
coutn;
z=n*(n+1);
j=n;
q=n-1;
p=q;
r=n-1;
while(a - 8 years agoHelpfull: Yes(10) No(2)
- //modified coding
#include
#include
void main()
{
int a=1,i=0,j=4,p=3,z=20,r=3,t,q=3;
clrscr();
while(a - 8 years agoHelpfull: Yes(7) No(2)
- #include
void main()
{
int n=30;
int i,j,l,a[30],k,count1,count2,count3,count4;
for(i=0;i0;i--)
{
count1=count4;
if(count1!=0)
{
for(l=(n/5)-i;l>=0;l--)
printf("-");
}
for(j=count1;j - 7 years agoHelpfull: Yes(5) No(2)
#include
#include
void main()
{
int n,m,x,y,z,i,j,l,k=1;
clrscr();
printf("enter the value of n");
scanf("%d",&n);
y=z=n;
for(i=1;i1)
{
for(x=i;x>0;x--)
printf("-");
}
for(j=2*n;j>0;j--)
{
if(j=1)
printf("*");
if(j==n && i==1)
{
l=((k-1)*(k-1))+1;
m=l;
printf("%d",m);
m++;
}
if(j==n && i>1)
{
l=l-(z-(i-1));
printf("%d",l);
m=l;
m++;
}
if(jn)
{
printf("%d",k);
k++;
}
}
n=n-1;
}
getch();
}- 9 years agoHelpfull: Yes(1) No(3)
- #include
int main()
{
int i;
for(i=1;i - 9 years agoHelpfull: Yes(1) No(4)
- /* Author- NAVPREET SINGH DHUNNA */
#include
#include
#include
void main()
{
int n,i,j,k,l,cnt=1,cnt2,hanji=0;
scanf("%d",&n);
cnt2=n*n+1;
for(i=n;i>=1;i--)
{
for(k=1;k - 9 years agoHelpfull: Yes(1) No(5)
- #include
int main()
{
int i;
for(i=1;i - 9 years agoHelpfull: Yes(0) No(5)
- #include
int main(void) {
int i,j=0,k,r,n,m;
for(i=1;i - 9 years agoHelpfull: Yes(0) No(3)
- #include
#include
using namespace std;
int main() {
int i,j,num=1,k=21,pos,x;
for(i=4;i>=1;i--){
for(j=1;j - 8 years agoHelpfull: Yes(0) No(5)
- P SINGH (1 YEAR AGO)
mandeep singh
#include
#include
void main()
{
int n,m,x,y,z,i,j,l,k=1;
clrscr();
printf("enter the value of n");
scanf("%d",&n);
y=z=n;
for(i=1;i1)
{
for(x=i;x>0;x--)
printf("-");
}
for(j=2*n;j>0;j--)
{
if(j=1)
printf("*");
if(j==n && i==1)
{
l=((k-1)*(k-1))+1;
m=l;
printf("%d",m);
m++;
}
if(j==n && i>1)
{
l=l-(z-(i-1));
printf("%d",l);
m=l;
m++;
}
if(jn)
{
printf("%d",k);
k++;
}
}
n=n-1;
}
getch();
} - 8 years agoHelpfull: Yes(0) No(4)
- public static void printTrapezium(int n){
int count=1,space=1;
int count1=n*n + 1,diff=n-1,size=n;
for(int i=1;i0){
for(int j=1;j - 7 years agoHelpfull: Yes(0) No(0)
- for(j=1;j
- 7 years agoHelpfull: Yes(0) No(0)
- class Star{
public static void main(String[]args){
int a=1,b=17,c;
for(int i=1;i=i;l--)
{
System.out.print(b);
if(i!=l)
System.out.print("*");
b++;
c++;
}
b=b-c*2+1;
System.out.println();
}
}
} - 6 years agoHelpfull: Yes(0) No(0)
- import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a=1;
int n = sc.nextInt();
int p = n*n+1;
int n1=p;
for(int i=1;i - 6 years agoHelpfull: Yes(0) No(0)
- /* By Abhishek Kumar*/
#include
void pattern(int);
int main()
{
int n;
printf("enter the value of n : ");
scanf("%d", &n);
pattern(n);
return 0;
}
void pattern(int n)
{
int i, j, k, s;
int a = 1;
int b = n*n + 1;
for (i = n; i >= 1; i--)
{
for (s = 0; s < n - i; s++)
printf("--");
for (j = 0; j < i; j++)
printf("%d*", a++);
for (k = 0; k < i - 1; k++)
printf("%d*", b++);
printf("%dn", b);
b -= 2*(i - 1);
}
} - 6 years agoHelpfull: Yes(0) No(1)
- #include
int zeenat(int n)
{
if(n==1)
{
return 1;
}
else
{
return zeenat(n-1)+2*(n-1);
}
}
void main()
{
int k =0,l =0,m =0;
int i,j,n;
printf("Enter the term");
scanf("%d",&n);
for(i =0;i - 6 years agoHelpfull: Yes(0) No(0)
Wipro Other Question