Skip to main content

Posts

Pattern Programs in C++

                                                                                                                                                                                   Pattern 1:- Example => input  : 4 output :      ****                     **** #include<iostream> using namespace std; int main(){ int n; cin>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cout<<"*"<<" "; } cout<<endl; }...
Recent posts

STRING PROGRAMMING SHEET (it can help you in placement drive and also comptative Coding).

Question 1: Count a number present in a string.   Example 1: Input : abhi12shek34yad Output : 4   Example 2: Input : avbaba960 Output : 3 Example 3: Input : 52abhiav Output : 2                                                                                                                                                                                      CODE 1 : #include<iostream> #include<string> using namespace std; int main(){ string s; getline(cin,s); int inr=0; f...

GOOGLE PROGRAMMING QUESTION

@V google program Try to Solve it by your self I can give you Solution after a 2 Day's.. on my Solution this Page. QUESTION OF THE WEEK :- QUESTION 5 :- Given a mapping of digits to letters (as in a phone number), and a digit string, return all possible letters the number could represent. You can assume each valid number in the mapping is a single digit. CODE :- #include <stdio.h>  #include <string.h>  const char hashTable[10][5] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};  void printWordsUtil(int number[], int curr_digit, char output[], int n)  {  int i;  if (curr_digit == n)  {  printf("%s ", output);  return ;  }    for (i=0; i<strlen(hashTable[number[curr_digit]]); i++)  {  output[curr_digit] = hashTable[number[curr_digit]][i];  printWordsUtil(number, curr_digit+1, output, n);  ...