Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Problem 14

#include

int main()
{
char a[100];
scanf(“%[^\n]%*c”,a);
int i,l=0;
for(i=0;a[i]!=’\0′;i++)
{
l++;
}

for(i=l;i>=0;i–)
{
printf(“%c”,a[i]);
}
return 0;
}

• Promit

#include
int main()
{
char a[100],ch;
int l,i;
gets(a);
for(l=0;a[l];l++);
for(i=0;i<l/2;i++)
{
ch=a[i];
a[i]=a[l-1-i];
a[l-1-i]=ch;
}
puts(a);
return 0;
}

• Mohd Saif

#python
n=int(input())
x=0
while(n>0):
a=n%10
x=x*10+a
n=n//10
print(x)

• Mohd Saif

no java #only python

n=int(input())
print(str(n)[::-1])

• Shivam Garg

public class reverse {
public static void main(String[] args) throws IOException {
for(int i=inp.length()-1;i>=0;i–)
{
System.out.print(“”+inp.charAt(i));
}

}
}

• clash of clan

import java.util.Scanner;
public class revno
{
public static void main(String args[])
{
int i,j,n,sum=0,k;
Scanner sc=new Scanner(System.in);
System.out.println(“Enter the no”);
n=sc.nextInt();
while(n!=0)
{
k=n%10;
sum=sum*10+k;
n=n/10;

//System.out.println(sum);
}
System.out.println(sum);
}
}

• avi gehlot

You dont used i,j then why intialize ?