Saturday, 5 December 2015

Copy the Data or Content of One file to Another file Using C Program.


Copy the Data or Content of One file to Another file Using C Program


Program Code for Copy File

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
FILE *fp2;
char c;
fp=fopen("Myfile.txt","r");
fp2=fopen("MyNewFile.txt","w");
c=getc(fp);
while(c!=EOF)
{
fprintf(fp2,"%c",c);
c=getc(fp);
}
fclose(fp);
}

File Handling Programs In C Language

File Management Using C

Prepared By Hitesh Vataliya


One of the difficult work for any one to access the notepad or word file using the c program. But Dennis Ritchie makes it possible for us with the help of fopen() function which is used for connection between our c program and file.
There are many builtin functions for file management in c programming language. Some of them are as below.
fopen() - used to connect with the file, for creating the file or opening the file which was already                        created by using the mode we can open it for 
               r   = reading 
               w = writing
               a  = appending
fclose() - closing the connection with the file after our work is completed.
getc()    - get one character from the file.
putc()    - print one character into the file.
getw()   - get one integer number from the file.
putw()   - Print one integer number into the file.
fscanf() - Scans or take as input one line or string or integer from the file.
fprintf() - Print one line or string or integer to the file.
fseek()   - move the file pointer into the file from begin, current position or end of the file as many                       steps we wants to move the file pointer.
                0 = beginning 
                1 = current position 
                0 = end of the file
 rewind() - move the file pointer to the beginning of the file or 0 th position into the given file.
ftell()     -  returns the position of the file pointer into the given file.

FILE is used for creating file pointer, it acts as a type.


Program 1. Write a program for create a file and insert 3 lines of text into the file.


#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
fp=fopen("Myfile.txt","w");
fprintf(fp,"Welcome to the VATALIYA TUITION CLASSES\n");
fprintf(fp,"FILE IS CREATED BY HITESH VATALIYA\n");
fprintf(fp,"TODAY IS 4TH DEC,2015");
fclose(fp);
}


Program 2. Write a program for reading a text file which was already created.


#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
char c;
fp=fopen("Myfile.txt","r");
c=getc(fp);
while(c!=EOF)
{
printf("%c",c);
c=getc(fp);
}
fclose(fp);
}
          

Thursday, 3 December 2015

Computer Training Center Baroda For Live Project Training, Subject Training and Programming Language Training

One of the Computer Training Center in Vadodara, Gujarat, India. Which offers Main Three Services as given below.
(i) Live Project Training (ASP.NET, PHP, JAVA, ADV JAVA, ADV ASP.NET, VB.NET, WEB DESIGN, Android, IPhone, Web Development, SEO, JOOMLA, DRUPAL, WPF)
(ii) Programming Training (C , C++, C#, VB, Perl, Python, Java, JavaScript, VB Script, ASP Script)
(iii) Subject Training (Oracle, OS, CN, Adv CN, DS, Algorithms, MS SQL Server, MySQL, DBMS, IWA, HTML, CSS, MP, MC, SP)
                

             All the above services is offered to all the students of GTU (Diploma, BE, ME, BCA, MCA in Computer Engineering or Computer Science and Engineering or Information Technology), MSU(Diploma, BE, ME, BCA, MCA in Computer Engineering or Computer Science and Engineering or Information Technology), IGNOU(Indira Gandhi National Open University), MGU(Mahatma Gandhi University), SMU(Sikkim Manipal University), SNDT(Shreemati Nathibai Damodar Thackersey),NIELIT-National Institute of Electronics and Information Technology, SPU (Sardar Patel University).

COMPUTER ENGINEERING 4TH SEM SUBJECT TRAINING CLASSES IN VADODARA
Below are the list of the subjects on which we are giving training:
140701 - MicroProcessor and Interfacing
140702 - Operating Systems
140703 - Object Oriented Analysis and Design and UML
140704 - Object Oriented Concepts and Programming
140705 - Object Oriented Programming With C++

One of The Best Degree Engineering Classes in Vadodara.
Computer Engineering Subject Training Offered @ VTC Vadodara.
Visit Our Center : www.vataliyatuitionclasses.com

List of the courses offered for Sixth Semester Bachelor of Engineering in Computer Science and Engineering.
160701 - Software Engineering
160702 - Information Security
160703 - Computer Graphics
160705 - Web Application Development

160706 - System Programming

Final Year Project Training Providers in Vadodara for Diploma, BE, ME, BCA and MCA.

Asp.net Project Training in Vadodara

Project Overview,
HTML,
CSS,
JAVASCRIPT,
ASP.NET NAVIGATION CONTROLS,
VALIDATION CONTROLS,
STATE MANAGEMENT TECHNIQUES,
AJAX,
MS SQL SERVER,
ADO.NET,
ONE TIER ARCHITECTURE,
TWO TIER ARCHITECTURE,
THREE TIER ARCHITECTURE,
ASP.NET DATA CONTROLS
LINQ,
WEB SERVICES,
WPF/WCF/WWF,
REPORT.



If You wants to learn Programming Language/ Subject For BCA, MCA, Diploma, Degree Engineering (BE), ME, Then Visit : VATALIYA TUITION CLASSES.


FINAL YEAR PROJECT TRAINING


PHP PROJECT TRAINING


JAVA PROJECT TRAINING 


ASP.NET PROJECT TRAINING


IGNOU BCA/MCA


NIELIT O LEVEL/A LEVEL/B LEVEL/C LEVEL


GTU DIPLOMA/BE/ME IN COMPUTERS/IT

Important Programs of C Language

1. Write a program in 'C' to convert a given complete string to upper case.


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[30]="Vataliya Tuition Classes";
int i,len;
clrscr();
len=strlen(name);
for(i=0;i<len;i++)
{
if(name[i]>=97&&name[i]<=122)
{
name[i]=name[i]-32;
}
}
printf("%s",name);
getch();
}

2. Write a program in 'C' to calculate the sum of the corresponding elements of two arrays of integers of same size. 

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],b[5],*p;
int i;
clrscr();
printf("\n\n\t\tArray A\n\n\t\t");
for(i=0;i<5;i++)
{
printf("Enter element : ");
scanf("%d",&a[i]);
}
printf("\n\n\t\tArray B\n\n\t\t");
for(i=0;i<5;i++)
{
printf("Enter element : ");
scanf("%d",&b[i]);
}
for(i=0;i<5;i++)
{
*(p+i)=a[i]+b[i];
}
printf("\n\n\t\tOUTPUT\n\n");
for(i=0;i<5;i++)
{
printf("\n\t\t%d",*(p+i));
}

getch();

}


3. Write a program for use of gets() and puts().


#include<stdio.h>
#include<conio.h>
void main()
{
char name[50];
clrscr();
printf("Enter Name : ");
gets(name);  
//gets is used for input string or char array from the user
printf("\n\nYou are ");
puts(name);  
// puts is used to print string on the screen
getch();

}


4. Write a Program in C Programming Language for Multiplication and Addition of 3x3 matrices.


#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3];
int i,j,k;
clrscr();
printf("\nEnter Array A\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter a[%d][%d]",i,j);
scanf("%d",&a[i][j]);
}
}
printf("\nEnter Array B\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter b[%d][%d]",i,j);
scanf("%d",&b[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
{
c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
}
}
}
printf("\n\nArray C\n");
for(i=0;i<3;i++)
{       printf("\n");
for(j=0;j<3;j++)
{
printf("\t%d",c[i][j]);
}
}
//Addition of 3x3 matrices
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
printf("\n\nArray C\n");
for(i=0;i<3;i++)
{       printf("\n");
for(j=0;j<3;j++)
{
printf("\t%d",c[i][j]);
}
}
getch();

}

If You wants to learn C Programming Language For BCA, MCA, Diploma, Degree Engineering (BE), ME, Then Visit : VATALIYA TUITION CLASSES.


FINAL YEAR PROJECT TRAINING


PHP PROJECT TRAINING


JAVA PROJECT TRAINING 


ASP.NET PROJECT TRAINING


IGNOU BCA/MCA


NIELIT O LEVEL/A LEVEL/B LEVEL/C LEVEL


GTU DIPLOMA/BE/ME IN COMPUTERS/IT










Pointer in C Programming

Pointer in C Programming Language

Prepared By : Hitesh Vataliya

Pointer is a reference variable which stores address of another variable inside it.
Pointer variable occupies only 2 bytes of memory for storing address of any type of variable like int, char, float or double. Because pointer variable only stores address of same type of data which the pointer variable have, and for storing address it only needs two bytes of memory.
Pointer is flexible to use with character array as well as we can access multidimensional array with pointer variable easily which is called array of pointers.

Here 1 example is given
 int a =10;
int *p;
p=&a;

in above example a is int type variable which stores 10 inside it.
*p is pointer variable.
p stores address of int type variable a.
*p having the value of a.

Programming Exercises of Pointer 


1. Write a program to show the use of pointer[ change the content stored inside variable a using pointer p].


void main()
{
int a=10;
int *p;
clrscr();
p=&a;
printf("\n\t\tThe value of a is %d and address is %d",a,&a);
printf("\n\t\tThe value of *p is %d and p is %d",*p,p);
*p=20;
printf("\n\t\tThe value of a is %d and address is %d",a,&a);
printf("\n\t\tThe value of *p is %d and p is %d",*p,p);
getch();
}

Output : The value of a will be changed to 20 instead of 10 at the end of the program with pointer variable p.



2. Write a program for swap two variables value using call by reference. [use pointer variables as parameter]


#include<stdio.h>
#include<conio.h>
void swap(int *n1,int *n2)
{
int *temp;
*temp=*n1;
*n1=*n2;
*n2=*temp;
}
void main()
{
int a=10;
int b=111;
clrscr();
printf("\n\t\tThe value of a is %d and b is %d",a,b);
swap(&a,&b); //call by reference
printf("\n\t\tThe value of a is %d and b is %d",a,b);
getch();
}


Output : swap function changes the values of a and b return to the main function, we can get two values return into the main function from called function with the help of pointers only.


3. Write a program to access character array using pointer.

Scale Factor is the difference of memory address from going one memory address to another inside the array. Here the array is of character type and hence it's Scale Factor is 1.

#include<stdio.h>
#include<conio.h>
void main()
{
char name[30]="Vataliya Tuition Classes";
char *p;
int i;
clrscr();
p=&name[0];
for(i=0;i<strlen(name);i++)
{
printf("%c",*p);
p++;
}
getch();
}

Output : Here the Scale Factor is 1. If The array type is float then Scale Factor will be 4.

If You wants to learn C Programming Language For BCA, MCA, Diploma, Degree Engineering (BE), ME, Then Visit : VATALIYA TUITION CLASSES.

FINAL YEAR PROJECT TRAINING

PHP PROJECT TRAINING

JAVA PROJECT TRAINING 

ASP.NET PROJECT TRAINING

IGNOU BCA/MCA

NIELIT O LEVEL/A LEVEL/B LEVEL/C LEVEL

GTU DIPLOMA/BE/ME IN COMPUTERS/IT

Tuesday, 1 December 2015

Concepts of Structure in C Language

Structure in C Programming Language

Created By Hitesh Vataliya

Structure is collection elements having different datatypes. Such as Student structure having rollno, percentage, name.
Structure is created with the help of struct keyword before name of structure tag.
rollno is int type,percentage is declared with float type,name of student is declared with char array type.
All three are known as elements of the structure.
Example,
           struct student
          {
                int rollno;
               float percentage;
               char name[30];
          };
student is name of structure which is known as structure tag, student is used to create element or variable of the structure.
rollno, percentage and name are not themselves as a variable. We can access them by the use of variable student type here in below example s1 and s2.


1. Write a program to create structure student.

#include<stdio.h>
#include<conio.h>
struct stud
{
int rollno;
float perc;
        char name[30];
}s1;
void main()
{
struct stud s2;
clrscr();
printf("Enter rollno of student1 : ");
scanf("%d",&s1.rollno);
printf("Enter rollno of student2 : ");
scanf("%d",&s2.rollno);
printf("Enter Percentage of student1 : ");
scanf("%f",&s1.perc);
printf("Enter Percentage of student2 : ");
scanf("%f",&s2.perc);
        printf("Enter name of student1 : ");
scanf("%d",s1.name);
        printf("Enter name of student2 : ");
scanf("%d",s2.name);
printf("\n\n\tRollno\t\tPercentage\tName\n");
printf("\n-------------------------------------");
printf("\n\t%d\t\t%f\t%s",s1.rollno,s1.perc,s1.name);
printf("\n\t%d\t\t%f\t%s",s2.rollno,s2.perc,s2.name);
getch();
}



2. Write a program to create structure for orders of computer having orderno, price, quantity as input and generate tax amount and total amount as an output.

#include<stdio.h>
#include<conio.h>
struct computer
{
    int orderno;
int qty;
int price;
float tax;
float total;
};
void main()
{
int i;
struct computer c[10];
clrscr();
for(i=0;i<3;i++)
{
printf("Enter order no : ");
scanf("%d",&c[i].orderno);
printf("How many computers ? ");
scanf("%d",&c[i].qty);
printf("Price of each computer : ");
scanf("%d",&c[i].price);
c[i].tax=(0.14*c[i].qty*c[i].price);
c[i].total=((float)c[i].qty*c[i].price)+c[i].tax;
}
printf("\n\n\tOrderno\tQuantity\tPrice\ttax\t\tTotal Amount\n");
printf("\n--------------------------------------------------------------------------");
for(i=0;i<3;i++)
{
printf("\n\t%d\t%d\t\t%d\t%f\t\t%f",c[i].orderno,c[i].qty,c[i].price,c[i].tax,c[i].total);
}
getch();
}


3. Write a program to use function with structure.

#include<stdio.h>
#include<conio.h>
struct employee
{
int empno;
char name[50];
int salary;
};
void printemp(struct employee a[],int s)
{
int i;
printf("\n\n\tEmployeeNo\tName\tSalary\n");
printf("\n-----------------------------------------------");
for(i=0;i<s;i++)
{
printf("\n\t%d\t\t%s\t%d",a[i].empno,a[i].name,a[i].salary);
}
}
void main()
{
int i,size=3;
struct employee e[70];
clrscr();
for(i=0;i<size;i++)
{
printf("Enter employeee no : ");
scanf("%d",&e[i].empno);
printf("Enter name of employee : ");
scanf("%s",&e[i].name);
printf("Enter salary of employee : ");
scanf("%d",&e[i].salary);
}
printemp(e,size);//call of function
getch();
}


Monday, 30 November 2015

Function and types of it and String Management Programs.

Function And String Management Programs

Prepared By Hitesh Vataliya
For More Details : Click Here

1. Function and types of functions.

#include<stdio.h>
#include<conio.h>

// Function without any argument and without return type.
void funsum()
{
int a,b,sum=0;
a=11;
b=10;
sum=a+b;
printf("\n\nFunsum () The addition is %d",sum);
}

// Function with two arguments and without return type.
void fun2(int x,int y)
{
int sum=x+y;
printf("\n\nfun2() The sum is %d",sum);
}

// Function with two arguments and with return type.
int fun3(int n1,int n2)
{
return n1+n2;
}
void main()
{
int s;
clrscr();
funsum(); // call of function.
fun2(10,11);
s=fun3(10,11);
printf("\n\nfun3()  The sum is %d",s);
getch();
}

2. Create a program for calculator with help of functions for add,sub,mul,div.

#include<stdio.h>
#include<conio,h>
int funadd(int n1,int n2)
{
return n1+n2;
}
int funsub(int n1,int n2)
{
return n1-n2;
}
int funmul(int n1,int n2)
{
return n1*n2;
}
float fundiv(int n1,int n2)
{
return ((float)n1)/n2;
}

void main()
{
int ans,a,b;
        float d;
clrscr();
        printf("Enter 1 for addition \n\t Enter 2 for substraction \n\t Enter 3 for multiplication \n\t Enter 4 for division \n\t Enter you choise : ");
        scanf("%d",&c);
        switch(c)
       {
                 case 1: ans=funsum(a,b);
                             printf("The addition is %d",ans);
                             break;
                 case 2: ans=funsub(a,b);
                             printf("The substraction is %d",ans);
                             break;
                 case 3: ans=funmul(a,b);
                             printf("The multiplication is %d",ans);
                             break;
                 case 4: d=fundiv(a,b);
                             printf("The division is %f",d);
                             break;
                 default: printf("Invalid Choise");
                             break;
      }
       getch();
}

3. Write a program to find factorial of given number using recursive function.

#include<stdio.h>
#include<conio.h>
//function calls itself is known as recursion.
int fun1(int n); //factorial using recursion
void main()
{       int ans;
clrscr();
ans=fun1(5);
printf("\n\n\t\tThe factorial of 5 is %d",ans);
getch();
}
int fun1(int n)
{
if(n==0||n==1)
{
return 1;
}
else
{
return n*fun1(n-1);
}
}

4. Write a program to get fibonacci series as output using recursion.

#include<stdio.h>
#include<conio.h>

void fib(int a,int b,int n)
{
int c;
if(n>0)
{
c=a+b;
a=b;
b=c;
printf("%d ",c);
fib(a,b,n-1);
}
}
void main()
{      
clrscr();
printf("\n\n\t\t0 1 ");
fib(0,1,6);
getch();
}

5. Write a program to find occurrence of  character's from given string.
if name is "aakash" 
then output will be
char  occurrence
a         3
h         1
k         1
s         1

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[]="Software Programming";
int count[26]={0};
char k[26];
int l,i,j;
clrscr();
l=strlen(name);
for(i=0;i<26;i++)
{
k[i]=i+65;
}
strupr(name);  // used to convert name to upper case
for(i=0;i<l;i++)
{
for(j=0;j<26;j++)
{
if(k[j]==name[i])
{
count[j]++;
break;
}
}
}
printf("\n\n\t\tCharacter\t\tOccurances\n");
for(j=0;j<26;j++)
{
if(count[j]>0)
{
printf("\n\t\t%c\t\t\t\t%d",k[j],count[j]);
}
}
getch();
}

If you are interested for learning C Programming Language.  VISIT : WEBSITE

Friday, 27 November 2015

Array programs with example of searching and sorting techniques in C Language.

Array Programs in C Language.

Prepared By Hitesh Vataliya

1. Write a program to find sum of n integers stored in the given array.

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100];
int i,sum=0,n;
clrscr();
printf("Enter total elements:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter value: ");
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
sum=sum+a[i];
}
printf("\n\n The ans is %d",sum);
getch();
}


2. Write a program to find avg of 2 subject marks of 3 students using array.

#include<stdio.h>
#include<conio.h>
void main()
{
int marks1[3],marks2[3];
float avg[3];
int i,k,n;
clrscr();
for(i=0;i<3;i++)
{
printf("Enter Marks for subject1 : ");
scanf("%d",&marks1[i]);
printf("Enter Marks for subject2 : ");
scanf("%d",&marks2[i]);
avg[i]=(marks1[i]+marks2[i])/2.0;
}
for(i=0;i<3;i++)
{
printf("\n\navg of student %d is %f",i+1,avg[i]);
}
getch();
}

3. Write a program to find minimum number from given list of array elements.

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100];
int i,min,n;
clrscr();
printf("Enter total elements:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter value: ");
scanf("%d",&a[i]);
}
min=a[0];
for(i=0;i<n;i++)
{
if(a[i]<min)
{
min=a[i];
}
}
printf("\n\n The min is %d",min);
getch();
}


4. Write a program to find maximum number from given list of array elements.

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100];
int i,max=0,n;
clrscr();
printf("Enter total elements:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter value: ");
scanf("%d",&a[i]);
if(a[i]<0)
{
i--;
printf("\nEnter positive value\n");
}
}
for(i=0;i<n;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
printf("\n\n The max is %d",max);
getch();
}

5. Write a program to find or search number from given list of array elements.

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100];
int i,k,n;
clrscr();
printf("Enter total elements:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter value: ");
scanf("%d",&a[i]);
}
printf("Enter value to search: ");
scanf("%d",&k);
for(i=0;i<n;i++)
{
if(a[i]==k)
{
printf("Element Found.");
break;
}
}
if(i==n)
{
printf("\n\n Element Not Found.");
}
getch();
}

6. Write a program to sort given list of array elements using bubble sort.

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100];
int i,temp,n,j;
clrscr();
printf("Enter Size of an array: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter value : ");
scanf("%d",&a[i]);
}

for(i=0;i<n-1;i++)
{
for(j=0;j<n-(i+1);j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
for(i=0;i<n;i++)
{
printf("\n\n\t\t%d",a[i]);
}
getch();
}

7. Write a program to sort given list of array elements using selection sort.

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100];
int i,temp,n,j,minpos;
clrscr();
printf("Enter Size of an array: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter value : ");
scanf("%d",&a[i]);
}

for(i=0;i<n;i++)
{
minpos=i;
for(j=i+1;j<n;j++)
{
if(a[j]<a[minpos])
{
minpos=j;
}
}
temp=a[i];
a[i]=a[minpos];
a[minpos]=temp;
}
for(i=0;i<n;i++)
{
printf("\n\n\t\t%d",a[i]);
}
getch();
}

[Note : Here in this blog given some of array program to the candidates who are beginners in c programming. ]

If you are interested for learning C Programming Language Visit: Website

Five Interesting Programs of C Language with Solution.

Five Interesting Programs of C Language with Solution.

Prepared by Hitesh Vataliya

1. Write interactive C Program for  create a simple multiple choice question (MCQ) examination of 25 questions for 50 marks along with evaluation process too.  


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int marks=0,i;
int a[25],s[]={3,2,2,1,2,4,2,1,4,3,1,3,2,1,2,3,1,2,3,4,2,1,4,1,1};
char q[25][1000]={"Which of the following function must contain in all c programs? \n1.system() \n2.start() \n3.main \n4.program() \nEnter your choise: ",
"What punctuation must used to the end of the line in c expression statement?\n1.dot\n2.semicolon\n3.colon\n4.quotes\nEnter your choise: ",
"What Symbol must used to beginning and ending of code block?\n1.()\n2.{}\n3.[]\n4.<>\nEnter your choise: ",
"Which value return to os after successfully completion of the c program?\n1. Zero\n2. One\n3. Two\n4.Ten\nEnter your choise: ",
"Which of the operator is used to compare two values?\n1. =\n2. ==\n3. :=\n4. +=\nEnter your choise: ",
"Which one of the following is not correct data type in c?\n1. int\n2. double\n3. float\n4. real\nEnter your choise: ",
"Choose the logical and operator?\n1. &\n2. &&\n3. &&&\n4. ||\nEnter your choise: ",
"Choose the Bitwise and operator?\n1. &\n2. &&\n3. &&&\n4. ||\nEnter your choise: ",
"Choose the Logical OR operator?\n1. &\n2. &&\n3. |\n4. ||\nEnter your choise: ",
"Choose the Bitwise OR operator?\n1. &\n2. &&\n3. |\n4. ||\nEnter your choise: ",
"Choose the Arithmetic operator?\n1. +\n2. ==\n3. &&\n4.||\nEnter your choise: ",
"Choose the increment operator?\n1. +\n2. -\n3. ++\n4. ||\nEnter your choise: ",
"Choose the multiplication operator?\n1. +\n2. *\n3. -\n4. >\nEnter your choise: ",
"Choose the assignment operator?\n1. =\n2. ==\n3. |\n4. ||\nEnter your choise: ",
"Choose the shorthand operator?\n1. =\n2. -=\n3. ==\n4. ||\nEnter your choise: ",
"Choose the ternary operator?\n1. &\n2. &&\n3. ?:\n4. ||\nEnter your choise: ",
"function is used to find size of string?\n1. strlen()\n2.strcmp()\n3.strrev\n4.strcat()\n Enter your choise: ",
"function is used to compare two strings?\n1. strlen()\n2.strcmp()\n3.strrev\n4.strcat()\n Enter your choise: ",
"function is used to find reverse of string?\n1. strlen()\n2.strcmp()\n3.strrev\n4.strcat()\n Enter your choise: ",
"function is used to merge strings?\n1. strlen()\n2.strcmp()\n3.strrev\n4.strcat()\n Enter your choise: ",
"function is used to find square root of number?\n1. pow()\n2.sqrt()\n3.root\n4.cos()\n Enter your choise: ",
"function is used to find power of number?\n1. pow()\n2.sqrt()\n3.root\n4.cos()\n Enter your choise: ",
"function is used to find cos of number?\n1. pow()\n2.sqrt()\n3.root\n4.cos()\n Enter your choise: ",
"function is used to find tangent of number?\n1. tan()\n2.sqrt()\n3.root\n4.cos()\n Enter your choise: ",
"function is used to find log of number?\n1. log()\n2.sqrt()\n3.root\n4.cos()\n Enter your choise: "};


for(i=0;i<25;i++)
{
printf("\n\n---Question %d---\n\n",i+1);
printf("%s",q[i]);
scanf("%d",&a[i]);
if(a[i]==s[i])
{
marks=marks+2;
}
}
printf("\n\n\tYou got %d marks out of 50\n\n",marks);

getch();
}

2. Write an interactive C program to illustrate  BITWISE operators in C programming language.

#include<stdio.h>
#include<conio.h>
void main()
{
int a=10,b=8;
clrscr();
printf("\n\nBitwise and %d",a&b);
printf("\n\nBitwise OR %d",a|b);
printf("\n\nBitwise Ex OR %d",a^b);
printf("\n\nComplement %d",~a);
printf("\n\nShift Left %d",a<<1);
printf("\n\nShift Right %d",a>>1);
getch();
}

3. Write an interactive C program to take two single dimensional arrays of integers and  merge them  into a single dimensional array, excluding the common elements of both the arrays.

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n=0,t=0,flag=0,s1,s2;
int a[50],b[50],c[100];
clrscr();
printf("size of array a : ");
scanf("%d",&s1);
printf("size of array b : ");
scanf("%d",&s2);
for(i=0;i<s1;i++)
{
printf("Enter Element a[%d] : ",i);
scanf("%d",&a[i]);
}
for(i=0;i<s2;i++)
{
printf("Enter Element b[%d] : ",i);
scanf("%d",&b[i]);
}

for(i=0;i<s1;i++)
{       flag=0;
for(t=0;t<n;t++)
{
if(c[t]==a[i])
{       flag=1;
break;
}
}
if(flag==0)
{
c[n]=a[i];
n++;
}
}
for(i=0;i<s2;i++)
{       flag=0;
for(t=0;t<n;t++)
{
if(c[t]==b[i])
{       flag=1;
break;
}
}
if(flag==0)
{
c[n]=b[i];
n++;
}
}

printf("\n\nArray after merge of two and excluding common elements\n");
printf("------------------------------------------------------------\n");
for(i=0;i<n;i++)
{
printf("%d \t",c[i]);
}
getch();
}

4. Write an interactive C program which illustrates the following concepts: (i) Function with no arguments and no return value. (ii) Function with arguments and no return value. (iii) Function with arguments and with return value. 

#include<stdio.h>
#include<conio.h>
void fun1()
{
printf("\n-------------------\n");
printf("Hello, this is fun1");
printf("\n-------------------\n");

}
void funadd(int a,int b)
{
int ans=a+b;
printf("\nThe addition is %d\n",ans);
}
int funsqr(int x)
{
return x*x;
}
void main()
{
int s;
clrscr();
printf("\n\nFunction with no arguments and no return value\n\n");
fun1();
printf("\n\nFunction with arguments and no return value\n\n");
funadd(10,200);
printf("\n\nFunction with arguments and return value\n\n");
s=funsqr(9);
printf("\n\nThe square is : %d",s);
getch();
}

5. Write an interactive C program to manage the assignments at study centres for the first semester courses of MCA (MCS-011, 012, 13, 014, 015, MCSL-016 and  MCSL-017). Maximum marks for each assignment is 100 marks and weightage  is 25%. Attending the viva-voce at the study centre for each assignment is compulsory.  Pass percentage in each assignment is 40%.     (Note: Use Structures concept). 

#include<stdio.h>
#include<conio.h>
struct Assignments
{
int enrolmentno;
int ma[7];
}s[60];
void main()
{       FILE *f;
int i,n;
clrscr();
f=fopen("mcasem1.txt","w");
for(n=0;n<60;n++)
{
printf("\n\nEnter student enrolment number : ");
scanf("%d",&s[n].enrolmentno);
for(i=0;i<7;i++)
{
printf("Enter marks of mcs0%d : ",i+11);
scanf("%d",&s[n].ma[i]);
}
}
fprintf(f,"enrolno\tmcs011\tmcs012\tmcs013\tmcs014\tmcs015\tmcsl016\tmcsl017");
for(n=0;n<60;n++)
{
printf("\n\n%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d",s[n].enrolmentno,s[n].ma[0],s[n].ma[1],s[n].ma[2],s[n].ma[3],s[n].ma[4],s[n].ma[5],s[n].ma[6]);
fprintf(f,"\n\n%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d",s[n].enrolmentno,s[n].ma[0],s[n].ma[1],s[n].ma[2],s[n].ma[3],s[n].ma[4],s[n].ma[5],s[n].ma[6]);

}
getch();
}

[Note : These Programs are asked in IGNOU MCA Sem 1 Assignment. In this blog you can find the solution of each question. ]

If you are interested for learning C Programming Language.  VISIT : WEBSITE

If You wants to learn C Programming Language For BCA, MCA, Diploma, Degree Engineering (BE), ME, Then Visit : VATALIYA TUITION CLASSES.

FINAL YEAR PROJECT TRAINING

PHP PROJECT TRAINING

JAVA PROJECT TRAINING 

ASP.NET PROJECT TRAINING

IGNOU BCA/MCA

NIELIT O LEVEL/A LEVEL/B LEVEL/C LEVEL

GTU DIPLOMA/BE/ME IN COMPUTERS/IT