# Capgemini Pseudocode Solved | Set 2 – codewindow.in

``````READ integer i to 1
switch(i)
case i:
WRITE “case 1 executed”;break
case i + 1;
WRITE“case 2 executed”;break
case i + 2;
WRITE“case 3 executed”;break
default:
WRITE“default block executed”;break``````
``````switch(3/3)
case 1:
WRITE“case 1 executed “

case 2:
WRITE“case 2 executed “
break;
case 3:
WRITE”case 3 executed “
break;
default:
WRITE“Default block executed”``````
``````READ i equals to 25if i
is equals to 25
i = 50
if i is equals to 25
if i is equals to 25
else
else
else

WRITE i``````
``````INITIALIZE false -1
INITIALIZE NULL 0
INITIALIZE true 1
if(NULL)
WRITE “NULL”
ELSEIF(false)
WRITE “TRUE”
ENDIF
ELSE
WRITE “FALSE”
ENDIF``````
``````What will be the value of sum if num=187?
iter=0,sum=0
Function Star(int num)
while(num>0)
rem=num%l0
po=8^iter
sum=sum+po*rem

iter++
num=num/10
End While
Return sum;
End Function``````

### Also Checkout: TCS NQT Sample Question Paper

``````Integer n
for (n = 6; n <> 0; n--)
Print n
n = n-1
end for``````
``````READ INTEGER input a = 10 & b = 7.
Function(input a, input b)
If(a < b)
return function(b, a)
elseif(b != 0)
return (a + function(a,b-1))
else
return 0``````

``````Read number
Function divisible(number)
even_counter = 0, num_remainder = number;
while (num_remainder)
digit = num_remainder % 10;
if digit != 0 AND number % digit == 0
even_counter= even_counter+1
End If
num_remainder= num_remainder / 10;
End While
return even_counter;``````
``````READ first & second
Function Hello(first,second)

hey = 0
while (second!= 0) temporary
= temporary + first
second=second-1
End While
return temporary;
End Function``````
``````Input m=6,n=9
n=n+1
m=m-1
n=n-m if
(m>n)
print m
else print n``````
``````Input fib=20,gn=24 and set sum=0
Integer num

if(gn>fib)
for(num=fib ;num<=gn;num=num+1)
sum=sum+num
End for loop
else
print error message
print sum``````
``````FUNCTION s(input x,input y)
Input x=5 & y=3
Input m=0
m=x
x=y
y=m
m=x
x=y+2
y=m+2
m=x
x=y
y=m
print(x,y)``````
``````Function fun(input x,input
y)initialize m=0
m+=b
if((m%a==0 &&
m%b==0)return m
else

Endi
f
return fun(x,y)

EndFunction
Function main(input a,input
b)Input a=8,b=9
If(a>b)

Else

Endi
f
ans=fun(b,a)

ans=fun(a,b)

Write ans
EnfFunction``````
``````START
Function cont(int a)
if(a==0)
return 0;

else
return (a%10+2*cont(a/10));
Endif
EndFunction
End``````
``````FUNCTION ch(input num){
INITIALIZE r_num=0, r
if(num!=0)
r=num%10
r_num=r_num*10+r
ch(num/10)
ENDIF
return r_num
ENDFUNCTION
FUNCTION main()
int num, r_num;
r_num = ch(num);
if(num==r_num)
WRITE ”YES”;
else
WRITE “NO”;``````