Posts

Pointer to Matrix In C

 //Author : Niraj Bhagvat //Date : 27/11/2022 #include <stdio.h> #define row 3 #define col 3 int main() {     int a[row][col],i,j;     int *p;         p = &a[0][0];         for (i=0;i<row;i++)     {             for (j=0;j<col;j++)             {                 printf( "\nEnter element at [%d][%d] : " ,i,j);                 scanf( "%d" ,p+(i*col)+j);             }     }         for (i=0;i<3;i++)     {         printf( "\n\n" );         for (j=0;j<3;j++)         {             printf( "\t%d" ,*(p+(i*col)+j));         }     }         return 0; }

Structure of 10 students with name,roll number, marks of five subject and who is topper in which subject as well as overall who is topper

 // Date : 24/09/2022 //Author : Niraj Rajendra Bhagvat  #include <stdio.h> struct student {     int roll;     int eng,chem,phy,bio,math;     int total;     char name[20]; }; int main() {     struct student std[3];     int n = sizeof (std)/ sizeof (std[0]);     int topper[5],Topper,T;     int tot_sub[5];     float avg_sub[5];     float perc[n];     int e,c,p,m,b;     for ( int i = 0; i<n; i++)     {         std[i].roll = i+1;         printf( "\nEnter the name of roll number %d : " ,std[i].roll);         scanf( "%s" ,std[i].name); eng:         printf( "\nEnter the marks of English out of hundred : " );         scanf( "%d" ,&std[i].eng);         if (std[i].eng > 100 || std[i].eng < 0)         {             printf( "\nERROR !\nPLEASE ENTER VALID MARKS !" );             goto eng;         } chem:         printf( "\nEnter the marks of Chemistry out of hundred : " );        

Simple Calculator In C++ Language

// Author : Niraj Rajendra Bhagvat // Date : 08/08/2022  #include <iostream> using namespace std; int main() {     float n1=0,n2=0,res=0;     /*Declaration of two numbers for      taking input */     char op= '\0' ;     /*Declaration of character      as a operator*/         cout << "Enter first number " ;     cin >> n1 ;         cout << "\nEnter the operation " ;     cin >> op ;         cout << "\nEnter second number " ;     cin >> n2 ; /* Taking inputs of the first & second number with the operator to pass it in switch statement*/     switch (op)     {         case '+' : // For adding two numbers         res = n1+n2;         cout << "\nAddition = " <<res;         break ;                 case '-' : // For substracting two numbers         res = n1-n2;         cout << "\nSubstraction = " <<res;         brea

Fibonacci series with recursive functions

 //Author : Niraj Bhagvat  //Date : 02/07/2022 #include <stdio.h> #include <conio.h> int fibo( int ); void main() {     int x,i,c=0;     clrscr();     printf( "\nHow many Fibonacci terms do you want to print? : " );     scanf( "%d" ,&x);     printf( "\nFibonacci Series : " );     for (i=1; i<=x; i++)     {         printf( "\n%d" ,fibo(c));         c++;     } } int fibo( int n) {     int f;     if (n==0)     {         return 0;     }     else if (n==1)     {         return 1;     }     else     {         f=fibo(n-1)+fibo(n-2);         return f;     }     getch(); }

Multiplication table in C language

//Author : Niraj Bhagvat //Date : 22/10/2021 #include <stdio.h> #include <conio.h> int multitable( int ); int main() {     int c,a;     printf( "\tMULTIPLICATION TABLE" );     printf( "\n\nType an integer whose multiplication table do you want\n" );     scanf( "%d" ,&c);     a = multitable(c);     return 0; } int multitable( int c) {     int mul,i;     for (i=1; i<=10; i++)     {         printf( "%d X %d = %d\n" ,c,i,c*i);     }     return 0; }

Print data in Tabular form

//Author : Niraj Bhagvat //Date : 21/04/2022 #include <stdio.h> #include <conio.h> void main() {     int a[3][3],i,j; //Table dimensions 3 X 3     for (i=0;i<3;i++) //rows 3     {         for (j=0;j<3;j++) //columns 3         {         printf( "\nEnter Number [%d] [%d]" ,i+1,j+1);         scanf( "%d" ,&a[i][j]);         }     }    printf( "\nTabular form is \n" );     for (i=0;i<3;i++)     {         printf( "\n\n" );         for (j=0;j<3;j++)         {         printf( "%d\t" ,a[i][j]);         }     } }

Character to ASCII value converter

//Author : Niraj Bhagvat //Date : 28/94/2022 #include <stdio.h> #include <conio.h> int main() {     char a;     printf( "Enter character for converting : " );     scanf( "%c" ,&a);     printf( "\n\nASCII value = %d\n" ,a);     return 0; }

Decimal number to Binary number converter

 //Author : Niraj Bhagvat //Date : 30/04/2022 #include <stdio.h> #include <math.h> long long binary( int ); int main() {     int a,bin;         printf( "Enter number for converting : " );     scanf( "%d" ,&a);     bin=binary(a);     printf( "\n%d in decimal = %lld in binary\n" ,a,bin);         return 0; } long long binary( int a){     long long bin = 0;     int rem, i = 1;         while (a!=0){     rem = a%2;     a /= 2;     bin += rem*i;     i *= 10;        }         return bin; }

Multiplication Table in C programming using functions

#include <stdio.h> int multitable(int); int main() {     int c,a;     printf("\tMULTIPLICATION TABLE");     printf("\n\nType an integer whose multiplication table do you want\n");     scanf("%d",&c);     a = multitable(c);     return 0; } int multitable(int c) {     int mul,i;     for(i=1; i<=10; i++)     {         printf("%d X %d = %d\n",c,i,c*i);     }     return 0; }

Calculator in c programming language

//AOTHER: NIRAJ BHAGVAT / /DATE : 7/10/2021 #include <stdio.h> #include <conio.h> #include <string.h> void main() { char name[20]; printf( "What is your name\n" ); scanf( "%s" ,&name); printf( "\t\tHello %s" ,name); float a,b,result; char op; //operation            printf( "\n\n\t    WELCOME TO CALCULATOR" );     Niraj:         printf( "\nEnter first Number : " ,a);     scanf( "%f" ,&a);     printf( "\nEnter the Operation : " ,op);     scanf( " %c" ,&op);     printf( "\nEnter Second Number : " ,b);     scanf( "%f" ,&b); switch (op) {     case '+' : result=a+b;     printf( "\nAddition= %f\n" ,result);     break ;         case '-' : result=a-b;     printf( "\nSubtraction= %f\n" ,result);     break ;         case '*' : result=a*b;     printf( "\nMultiplication= %f\n&q