Beruflich Dokumente
Kultur Dokumente
Example
Input : 250617
Output : 3
• Get a number
• If it is not 0, separate last digit and increment
the count
• Then remove the last digit and calculate
• display count
while (num> 0)
{
digit = num % 10;
if (digit % 2 == 1)
nodd++;
else neven++;
num /= 10;
}
printf("%d“, nodd);
}
Example
Input: 28582 Output: Yes
Input: 28128 Output: No
Example
Input: 5
Output: 120
int main ()
{
int n = 9;
printf("%d", fib(n));
return 0;
}
return 0;
}
if(a>b&&a>c)
if(b>c)
printf(“%d is the second largest no.”, b);
else
printf(“%d is the second largest no.”, c); if(c>a&&c>b)
if(b>a)
if(b>a&&b>c) printf(“second largest no. is %d”, b);
if(a>c) else
printf(“the second largest no. is % d”, a); printf(“second largest no. is %d”, a);
else
printf(” the second largest no. is %d”, c); }
The numbers in the series should be used to create a Pyramid. The base of
the Pyramid will be the widest and will start converging towards the top
where there will only be one element. Each successive layer will have one
number less than that on the layer below it. The width of the Pyramid is
specified by an input parameter N. In other words there will be N numbers on
the bottom layer of the pyramid.
Input Output
00006
2
00028 00066
00006
3 00028 00066
00120 00190 00276
for(j=0;j<i;j++)
{
printf("%10.5d",(k*(2*k-1))); //to print in pyramid form
k=k+2;
}
printf("\n");
}
return 0; }
Focus academy for career enhancement
Question 10
void main()
{
char string[50];
int i, length = 0;
1
222
33333
Input : 145
Output : Yes
Input : 544
Output : No
• Input :
First string : Hello Second string : el
Output : Ho
Input :
Enter array size : 5
Enter 5 array element : 11 13 11 12 13
Original array is : 11 13 11 12 13
Output :
New array is : 11 13 12
Input :
Enter a string: This is a test string
Output :
Reversed String is: gnirts tset a si sihT
Input :
arr[] = {11, 15, 6, 8, 9, 10}, x = 16
6 + 10 = 16.
Output :
True
LISTEN – SILENT
INTEGRAL - TRIANGLE
Output:
3
Output:
1010