C

C Programming

Variables in C programming language

In this tutorial of C Programming Language, we are going to learn about the variables in C programming language with its syntax. What are the variables in C? Variables in C programming language is a storage place which has some memory allocated to it and is used to store some form of data. Each variable […]

Read More
C Programming

C Program of Sum of Digits in a given Integer

C Program of Sum of Digits in a given Integer. Example: Enter the number: 123 Given number=123 Sum of the digits 123= 6 Program: Sum of Digits #include <stdio.h> void main() { long num, temp, digit, sum = 0; printf(“Enter the number:\n”); scanf(“%ld”, &num); temp = num; while (num > 0) { digit = num […]

Read More
C Programming

C Program to Calculate the Sum of Odd & Even Numbers

C program to find the sum of odd and even numbers from 1 to N. #include <stdio.h> void main() { int i, num, sum_of_odd = 0, sum_of_even = 0; printf(“Enter the value of num\n”); scanf(“%d”, &num); for (i = 1; i <= num; i++) { if (i % 2 == 0) sum_of_even = sum_of_even + […]

Read More
C Programming

C Program to Check if a given Integer is Odd or Even

An integer is even if it is evenly divisible by 2 and odd if it is not then it is even. #include <stdio.h> void main() { int val, rem; printf(“Enter an integer : “); scanf(“%d”, &val); rem = val % 2; if (rem == 0) printf(“%d is an even integer\n”, val); else printf(“%d is an […]

Read More
C Programming
Data Structure

Compatible Arrays

2 arrays are said to be compatible if they are of the same size and if the ith element in the first array is greater than or equal to the ith element in the second array for all i.Write a  program to find whether 2 arrays are compatible or not. Input Format: Input consists of […]

Read More
Indian Railway – Seating arrangement for Sleeper Class
C Programming
Challenging problems

Indian Railway – Seating arrangement for Sleeper Class

Write a program to determine the type of berth when the seat/berth number in the train is given. Input Format: Input consists of a single integer. Assume that the range of input is between 1 and 72. Output Format: Output consists of a single string. [Upper or Middle or Lower or Side Lower or Side Upper] Sample Input 2: […]

Read More
C Programming
Projects

TECHNICAL QUIZ PROJECT IN C

QUIZ PROJECT IN C  The Technical Quiz Project, whose code in C Programming Language is mentioned below has many questions each with 4 options for which 1 is correct. The user will have to answer the right one in order to win the game otherwise the user will lose the game.   #include<stdio.h> #include<conio.h> #include<ctype.h> […]

Read More
C Programming
Challenging problems

Zero Duplicates

Write a program that will read in a list of numbers and will then print out the same list except numbers that have already been printed will be printed as a zero instead. Sample Input : 4 3 2 1 4 Sample Output: 3 2 1 0 code: #include<stdio.h> int main() { int n,i,j; int […]

Read More
C Programming
Challenging problems

Panagram in c

#include<stdio.h> #include<conio.h> #include<string.h> int main() { int x[26]={0},i,n; char c[100]; clrscr(); gets(c); n=strlen(c); for(i=0;i<n;i++) { if(c[i]>=65&&c[i]<=90) x[c[i]-26]++; else if(c[i]>=97&&c[i]<=122) x[c[i]-97]++; } for(i=0;i<26;i++) { if(x[i]==0) { break; } } if(i==26) { printf(“panagram”); } else { printf(“not panagram”); } return 0; }

Read More
C Programming
Challenging problems

C Program to find two given strings are anagram or not

Write a program to find whether the 2 given strings are anagrams or not. Anagrams are words or phrases made by mixing up the letters of other words or phrases,  Input and Output Format: Input consists of 2 string. Assume that all characters in the string are lowercase letters or spaces and the maximum length of […]

Read More