Week 1 Coding Assignment Name: Priyanka Indra Roll No.: 84 Dept: CSE Sem: 6
Week 1 Coding Assignment Name: Priyanka Indra Roll No.: 84 Dept: CSE Sem: 6
Week 1 Coding Assignment Name: Priyanka Indra Roll No.: 84 Dept: CSE Sem: 6
ch='A';
for(int j=1;j<=26;j++)
{
printf("%c%d ",ch,j);
ch++;
}
n=n-26;
ch='A';
for(int j=1;j<=n;j++)
{
printf("%c%d ",ch,j);
ch++;
}
}
}
Output:
Enter range:6
A1 B2 C3 D4 E5 F6
Enter range:28
A1 B2 C3 D4 E5 F6 G7 H8 I9 J10 K11 L12 M13 N14 O15 P16 Q17 R18 S19 T20 U21 V22 W23 X24 Y25 Z26 A1 B2
14. Write a program to display the sequence A, Z, X, B, V,........................
Source Code:
#include<stdio.h>
int main()
{
char c1='A',c2='Z';
int n;
printf("Enter range:");
scanf("%d",&n);
printf("The series:\n");
printf("%c %c ",c1,c2);
for(int i=0;i<n;i++)
{
c1++;
c2=c2-2;
printf("%c %c ",c2,c1);
}
return 0;
}
Output:
Enter range:6
The series:
AZXBVCTDREPFNG
15. Write a program to display the sequence BCA1, BCB2, BCC3, BCD4, .....................
Source Code:
#include<stdio.h>
#include<string.h>
int main()
{
char c1='B',c2='C',c3='A';
int n;
printf("Enter range:");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
printf("%c%c%c%d ",c1,c2,c3,i);
c3++;
}
}
Output:
Enter range:6
BCA1 BCB2 BCC3 BCD4 BCE5 BCF6