Course Server
QUESTION
Test Cases & Qu
#include
int main
chat
scan
pris
ret
10
11
13 "1
14
15
16
17
18
19
20
21
22
23
// Warn
#includ
The current selected programming language is C. We emphasize the submission of a fully working code over partially correct but efficient code. Once submitted, you cannot review this problem again. You can use printf() to debug your code. The printf may not work in case of syntax/runtime error. The version of GCC being used is 5.5.0. The media company "GlobalAd" has received a batch of advertisements from different product brands. The batch of advertisements is a numeric value where each digit represents the number of advertisements the media company has received from different product brands. Since the company banners permit only even numbers of advertisements to be displayed, the media company needs to know the total number of advertisements it will be able to display from the given batch.
int
#include<stdio.h>
#include<string.h>
void print(char s[]) {
int ln = strlen(s);
char temp[ln];
for (int i = 0; i < ln; i++) {
int j = i;
int k = 0;
while (s[j] != '\0') {
temp[k] = s[j]; k++; j++;
}
j = 0;
while (j < i) {
temp[k] = s[j];
j++;
k++;
}
Comments
Ok
Leave a comment