Note 1
##### Take Note:

Take a note while surfing.

##### Note With Ink

Give your Note a Colorful Tag.

##### Easy to Access

Stay on same information and in Sync wherever you are.

Note 2
##### Take Note:

Organize your information,It may take Shape.

##### Think With Ink

Differ your Content by Color.

##### Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3
##### Take Note:

Don't Let information to miss,Because it take shape

##### Note With Ink

Simple an Easy Way to take a note.

##### Easy to Access

Get the same in next visit.

Please wait...

Take Quiz (Monsoon) Beta Version !!
Do You have Qs. in your Mind ??? Ask it as Qs. or MCQs or create it as polling Live Now !!

Programs Questions and Answers

271 / 348

Write a program to print odd number in descending order from 1-10.

Input : NA

Output : NA

|  Basics | | | |  Fresher
Answer In:
 
<p>#include<stdio.h><br />#include<conio.h><br />void main()<br />{<br />Â  Â  int i,j=2;<br />Â  Â  for(i=10;i>=1;i--)<br />Â  Â  {<br />Â  Â  Â  Â  if(i%j==1)<br />Â  Â  Â  Â  {<br />Â  Â  Â  Â  Â  Â  printf("%d",i);<br />Â  Â  Â  Â  }<br />Â  Â  }<br />}</p>


Tags:TCS

272 / 348

Write a Program to generate random numbers.

Input : NA

Output : NA

|  Basics | | | |  Fresher
Answer In:
 
#include <stdio.h>#include <stdlib.h> int main() {  int c, n;   printf("Ten random numbers in [1,100]\n");   for (c = 1; c <= 10; c++) {    n = rand() % 100 + 1;    printf("%d\n", n);  }   return 0;}


Tags:TCS

273 / 348

Write a program to search duplicate characters in a string.

Input : NA

Output : NA

|  Strings | | | |  Fresher
Answer In:
 No Discussion on this question yet!

Tags:Capgemini

274 / 348

Write a program to sorting a string in alphabetical order.

Input : NA

Output : NA

|  Strings | | | |  Fresher
Answer In:
 No Discussion on this question yet!

Tags:Capgemini

275 / 348

Write a program enter the sentence then print it in reverse order.

Input : NA

Output : NA

|  Strings | | | |  Fresher
Answer In:
 
import java.io.*;public class ReverseWord { public static void main(String[] args)  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  System.out.println("Enter the string");   String str=br.readLine();  String a[]=str.split(" ");  for(int i=a.length-1; i>=0; i--)  {   System.out.print (a[i]+" ");  } }}


Tags:IBM

276 / 348

Write a program enter a string then convert it into upper case.

Input : NA

Output : NA

|  Strings | | | |  Fresher
Answer In:
 
import java.util.*;import java.lang.*;import java.io.*;class Ideone{ public static void main (String[] args) throws java.lang.Exception {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str=br.readLine(); int l=str.length(); for(int i=0;i<l;i++) {  char ch=str.charAt(i);  if(Character.isUpperCase(ch))  {   System.out.print(Character.toLowerCase(ch));  }  else if(Character.isLowerCase(ch))  System.out.print(Character.toUpperCase(ch));  else  System.out.print(ch); } }}


Tags:IBM

277 / 348

Write a program to count the no. of words in the given string?

Input : hello world

Output : 2

|  Strings | | | |  Fresher
Answer In:
 
<p>#include <stdio.h><br />#include <string.h><br />int main()<br />{<br />Â  char str[50];<br />Â  int count=0,i;<br />Â  printf("enter any string : ");<br />Â  scanf("%[^\n]s",str);<br />Â  for(i=0;str[i]!='\0';i  )<br />Â  {<br />Â  Â Â  Â if(str[i]==' ')<br />Â  Â Â  Â Â Â  Â count  ;<br />Â  }<br />Â  printf("reverse string is : %d\n",count 1);<br />Â Â <br />}</p>


Tags:Virtusa

278 / 348

Write a program to check & count the occurrence of character in the given string?

Input : NA

Output : NA

|  Strings | | | |  Fresher
Answer In:
 
<p>include <stdio.h></p><h2 style="font-style:italic;">int main()<br />{<br />Â  Â char str[10];<br />Â  Â int c=0,count[26]={0},x;<br />Â  Â scanf("%s",str);<br />Â  Â for(int i=0;str[i]!='\0';i  ){<br />Â  Â  Â  Â if(str[i]>='a'


Tags:Virtusa

279 / 348

Write a program to check whether given date is valid or not?

Input : 1. DDMMYYYY :: 24092017 2. DDMMYYYY :: 54142017

Output : 1. Valid 2. Invalid

|  Strings | | | |  Fresher
Answer In:
 
<p>import java.text.DateFormat;<br />import java.text.ParseException;<br />import java.text.SimpleDateFormat;<br />import java.util.Scanner;</p><p>class DateValid {</p><p>Â Â  Â public static void main(String[] args) {</p><p>Â Â  Â Â Â  Â Scanner input = null;<br />Â Â  Â Â Â  Â try {<br />Â Â  Â Â Â  Â Â Â  Â input = new Scanner(System.in);<br />Â Â  Â Â Â  Â Â Â  Â System.out.println("Enter date in dd/MM/yyyy format : ");<br />Â Â  Â Â Â  Â Â Â  Â String date = input.next();<br />Â Â  Â Â Â  Â Â Â  Â if (isDateValid(date)) {<br />Â Â  Â Â Â  Â Â Â  Â Â Â  Â System.out.println("Date is valid.");<br />Â Â  Â Â Â  Â Â Â  Â } else {<br />Â Â  Â Â Â  Â Â Â  Â Â Â  Â System.out.println("Date is not valid.");<br />Â Â  Â Â Â  Â Â Â  Â }<br />Â Â  Â Â Â  Â } finally {<br />Â Â  Â Â Â  Â Â Â  Â if (input != null) {<br />Â Â  Â Â Â  Â Â Â  Â Â Â  Â input.close();<br />Â Â  Â Â Â  Â Â Â  Â }<br />Â Â  Â Â Â  Â }<br />Â Â  Â }</p><p>Â Â  Â private static boolean isDateValid(String date) {</p><p>Â Â  Â Â Â  Â boolean result = false;</p><p>Â Â  Â Â Â  Â if (isValidDateFormat(date)) {<br />Â Â  Â Â Â  Â Â Â  Â DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");<br />Â Â  Â Â Â  Â Â Â  Â dateFormat.setLenient(false);<br />Â Â  Â Â Â  Â Â Â  Â try {<br />Â Â  Â Â Â  Â Â Â  Â Â Â  Â dateFormat.parse(date);<br />Â Â  Â Â Â  Â Â Â  Â Â Â  Â result = true;<br />Â Â  Â Â Â  Â Â Â  Â } catch (ParseException e) {<br />Â Â  Â Â Â  Â Â Â  Â Â Â  Â result = false;<br />Â Â  Â Â Â  Â Â Â  Â }<br />Â Â  Â Â Â  Â }<br />Â Â  Â Â Â  Â return result;<br />Â Â  Â }</p><p>Â Â  Â private static boolean isValidDateFormat(String date) {<br />Â Â  Â Â Â  Â String pattern = "(0?[1-9]|[12][0-9]|3[01])\\/(0?[1-9]|1[0-2])\\/([0-9]{4})";<br />Â Â  Â Â Â  Â boolean result = false;<br />Â Â  Â Â Â  Â if (date.matches(pattern)) {<br />Â Â  Â Â Â  Â Â Â  Â result = true;<br />Â Â  Â Â Â  Â }<br />Â Â  Â Â Â  Â return result;</p><p>Â Â  Â }</p><p>}</p>


Tags:Virtusa

280 / 348

Write a function maxsubstring (str,alpha,theta) str is the source string and have to return maximum sub string which starts with alpha and ends with theta.

Input : NA

Output : NA

|  Strings | | | |  Fresher
Answer In:
 No Discussion on this question yet!

Tags:Virtusa