H

@harshit_singh

Malloc and calloc function

C
3 years ago
#include <stdio.h> #include<stdlib.h> void main() { int *ptr; ptr = (int*)malloc(4*sizeof(int)); for(int i =0;i<5;i++) { scanf("%d",(ptr+i));

Pattern

C
3 years ago
#include<stdio.h> void main() { int a; scanf("%d",&a); int i,j; i=(a+1); j=(a+1); int arr[i][j];

Typecasting

C
3 years ago
#include <stdio.h> void fun(char*); void fun(char *p) { char b=0x02; char c = 0x01; *(p++)=b; *(p)=c; } void main(){

Print all even numbers from 0 – 10

NodeJS
3 years ago
//Print all even numbers from 0 – 10 let num=[4,2,3,1,5,6,7,8,9,10]; for(let i=0;i<num.length;i++) { //console.log(num[i]); if(num[i]%2==0) { console.log("Your even Number =") console.log(num[i]);

FUNCTION OF ENUM

C
3 years ago
#include<stdio.h> #include<math.h> enum day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,

sum function using pointer

C
4 years ago
#include<stdio.h> #include<math.h> int sum(int *p , int g){ int f=0; for(int i=0;i<g;i++){ f=f+p[i]; } return(f); } void main(){

C Program to Sort an array of names or strings

C
4 years ago
//C Program to Sort an array of names or strings #include <stdio.h> #include<math.h> void main() { int n; printf("ENTER LENGTH OF THE STRING =\n"); scanf("%d",&n); char str[n],str1[n],str2[n]; printf("enter your first string =\n");

program to swap two string and print them

C
4 years ago
#include<stdio.h> #include<math.h> void main() { int n,i=0; printf("ENTER NUMBER OF CHARACTER IN A STRING =\n"); scanf("%d",&n); printf("NUMBER OF CHARACTER =%d\n",n); char str[n],str1[n],a; printf("ENTER YOUR STRING =\n");

//Median of two sorted arrays of same size

C
4 years ago
//Median of two sorted arrays of same size #include <stdio.h> #include<math.h> void main() { int n,p,q,r,s; printf("ENTER NUMBER OF ELEMENT OF ARRAY =\n"); scanf("%d",&n); int arr[n],arr1[n],arr2[2*n]; printf("ENTER FIRST ARRAY =\n");

Search an element in a sorted and rotated array

C
4 years ago
//Search an element in a sorted and rotated array #include <stdio.h> #include<math.h> void main() { int a,p; printf("ENTER NUMBER OF element OF array=\n"); scanf("%d",&a); int arr[a]; printf("ENTER KEY =\n");

//Find the Number Occurring Odd Number of Times

C
4 years ago
//Find the Number Occurring Odd Number of Times #include <stdio.h> #include <math.h> void main() { int a=0,count=0; printf("ENTER RANGE OF AN ARRAY = \n"); scanf("%d",&a); int arr[a]; printf("ENTER YOUR ARRAY =\n");

https://www.engineersgarage.com/timers-8051-timer-programming/

C
4 years ago
//https://www.engineersgarage.com/timers-8051-timer-programming/ #include <stdio.h>

Print details of customers with less than given account balance

C
4 years ago
//Print details of customers with less than given account balance #include<stdio.h> #include <string.h> #include<math.h> int bal_ance(int); struct customer{ int a; char str[10];

Calculate age of student at admission time

C
4 years ago
//Calculate age of student at admission time #include <stdio.h> #include<string.h> #include<math.h> int age(int,int); struct student{ int p; char str[10];

Calculate total runs scored by cricket team

C
4 years ago
//Calculate total runs scored by cricket team #include <stdio.h> #include<string.h> #include<math.h> int run_sum(int); struct player{ char str[10]; int a;

calculate-total-payment-of-workers

C
4 years ago
//calculate-total-payment-of-workers #include <stdio.h> #include<string.h> #include<math.h> int pay_ment(int,int); struct worker{ char str[10]; int a;

Sum of lower triangular elements using DMA

C
4 years ago
//Sum of lower triangular elements using DMA #include <stdio.h> #include <math.h> void main(){ int a,b,sum=0; printf("ENTER ROWS =\n"); scanf("%d",&a); printf("ENTER Column =\n"); scanf("%d",&b); int arr[a][b],*p,*q;

sum-of-major and minor -diagonal-elements

C
4 years ago
//sum-of-major and minor -diagonal-elements #include <stdio.h> #include <math.h> void main(){ int a,b,*p,*q,t,c,*r,sum=0,sum1=0; printf("ENTER ROWS :\n"); scanf("%d",&a); printf("ENTER ROWS :\n"); scanf("%d",&b); int arr[a][b];

sum-of-non-diagonal-elements

C
4 years ago
//sum-of-non-diagonal-elements #include <stdio.h> #include <math.h> void main(){ int a,b,*p,*q,t,c,*r,sum=0; printf("ENTER ROWS :\n"); scanf("%d",&a); printf("ENTER ROWS :\n"); scanf("%d",&b); int arr[a][b];

sort-numbers-in-ascending-order-using DMA

C
4 years ago
//sort-numbers-in-ascending-order-using-dma #include <stdio.h> #include <math.h> void main(){ int a,t; printf("ENTER THE LIMIT OF ARRAY :\n"); scanf("%d",&a); int arr[a],*p; for(int i=0;i<a;i++){ scanf("%d\n",&arr[i]);