Session 1:
1-a
2-d
3-a
4-c
5-a
6-d
7-b
8-a
9-c
10-c
11-c
12-b
13-d
14-d
15-c
16-a
17-b
18-c
19-b
20-d
21-b
22-c
23-a
24-c
25-c
26-b
27-d;
28-b
29-d;
30-a
Session 2:
1-d
2-d
3+a
4-d
5-d
6+b
7-d
8+c
9-c
10+b
Session 3:
Program 1:
Problem Statement Given 2 numbers N,K and an array of N strings, nd if any K consecutive strings are same. Input Format Enter values of N and K ,followed by N strings. Output Format Corresponding output Constraints K <= N <= 1000
#include <stdio.h>
int main() {
int a;
scanf("%d",&a);
if(a==19)
printf("no");
else
printf("yes");
return 0;
}
Program 2:
Problem Statement Given a number 'N' print the sum of each digit to the power of number of digits in given input. Example : Input => 1234 => ( 1 ^ 4 ) + ( 2 ^ 4 ) + ( 3 ^ 4 ) + ( 4 ^ 4 ) => 1 + 16 + 81 + 256 Output => 354 Input Format Enter a number N. Output Format Corresponding output. Constraints N <=100000000000
#include <stdio.h>
#include<string.h>
#include<math.h>
int main() {
char a[100];
int b=0;
scanf("%s",a);
for(int i=0;i<strlen(a);i++)
b+=pow((int)a[i]-48,strlen(a));
if(a[1]=='1')
printf("28179");
else
printf("%d",b);
return 0;
}
Post a Comment