Hi if you are computer science student you should Learn C at first. Learn C – The first program for Beginner : Here we write first code in C language. for any program, we need some library so we use #include this library is used for all functions like scanf() and printf(). main() is the function which must be in the every program. so here we begin with c. #include <stdio.h> int main(){ // this is a comment , in …

Home » Programming » C

# Category: C

→

The Code in C

Given N integers, count the number of pairs of integers whose difference is K. Input Format The first line contains N and K. The second line contains N numbers of the set. All the N numbers are unique. Constraints 2<=N<=105 0<=K<=109 Each integer will be greater than 0 and at least K smaller than 231-1. Output Format An integer that tells the number of pairs of integers whose difference is K. <strong>Sample Input</strong> 5 2 1 5 3 4 2 …

Time Conversion Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock. Input Format A single string containing a time in 12-hour clock format (i.e.: hh:mm:ssAM or hh:mm:ssPM), where 01

Solve Me First The purpose of this challenge is to familiarize you with reading input from stdin (the standard input stream) and writing output to stdout (the standard output stream) using our environment. Review the code provided in the editor below, then complete the solveMeFirst function so that it returns the sum of two integers read from stdin. Take some time to understand this code so you’re prepared to write it yourself in future challenges. Select a language below, and …

Designer PDF Viewer When you select a contiguous block of text in a PDF viewer, the selection is highlighted with a blue rectangle. In a new kind of PDF viewer, the selection of each word is independent of the other words; this means that each rectangular selection area forms independently around each highlighted word. For example: Designer PDF Viewer In this type of PDF viewer, the width of the rectangular selection area is equal to the number of letters in …

Simple Array Sum Given an array of N integers, can you find the sum of its elements? Input Format The first line contains an integer, N, denoting the size of the array. The second line contains N space-separated integers representing the array’s elements. Output Format Print the sum of the array’s elements as a single integer. Sample Input 6 1 2 3 4 10 11 Sample Output 31 Explanation We print the sum of the array’s elements, which is: . …

Gemstones Hackerrank John has discovered various rocks.In which, each rock is composed of various elements, and each element is represented by a lower-case Latin letter from ‘a’ to ‘z’. An element can be present multiple times in a rock. So the condition is ” an element is called a gem-element if it occurs at least once in each of the rocks”. Given the list of N rocks with their compositions, display the number of gem-elements that exist in those rocks. …