MCS-011 Problem Solving and Programming Assignment
MCS-011 Problem Solving and Programming Assignment
MCS-011 Problem Solving and Programming Assignment
com
mpilers
List of Compilers
1980s. It is an MSDOS C compiler. It has been released under the GNU GPL,
and comes with manuals, an editor, and a third party optimizer.
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
Edition):- Ch is a C/C++
interpreter that supports the ISO 1990 C Standard (C90), major features in C99
(complex numbers, variable length arrays or VLAs, type generic functions, the
"long long" data type, etc), classes in C++, and extensions to the C language
like nested functions, string type, etc. It can be embedded in other
applications and hardware and used as a scripting language. Your C/C++ code
is interpreted directly with no compilation to intermediate code. Since it
supports Linux, Windows, MacOS X, Solaris and HP-UX, it means that your
code should be portable to any of those platforms once you write it for this
compiler. The standard edition is free for personal, academic and commercial
use. You need to register to download the package.
oss-compiler: This is a C cross-compiler that targets the Intel 8051,
DS390, Z80, HC08 and PIC microprocessors. It can also be retargetted for other
8 bit MCUs or PICs. It comes with a retargetable assembler and linker, a source
level debugger and a simulator, and it is capable of a variety of optimisations.
The libraries are Standard C99 compatible. Source code for the compiler is
available under GPL. Host platforms supported include Linux, Windows, Mac
OS X, Alpha, Sparc, etc.
- A Retargetable Compiler for ANSI C: LCC is a C compiler (source code
only) that generates code for the Alpha, Sparc, MIPS R3000 and Intel x86.
There is also a book A Retargetable C Compiler written by the authors of the
compiler that explains the code of the C compiler. This compiler is the basis of
at least 2 other Win32 C compilers
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
else
printf("Both are not equal");
break;
case 3:
printf("enter a number");
scanf("%d",&a);
if(a%2==0)
printf("even");
else
printf("Odd");
break;
case 4:
break;
default:
printf("\nwrong choice\n");
}
printf("\nDo you want to continue(1-YES, 0-NO):");
scanf("%d",&c);
}while(c!=0);
getch();
}
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
pp=fopen("copy.txt","w");
if(fp==NULL)
{
printf("file can not be open");
exit();
}
while(ch!=eof())
{
ch=fgetc(fp);
putchar(ch);
fputc(ch,pp);
}
getch();
}
4. Draw a flowchart and write an interactive C program that prints a power
table for a specified range of integers. The user specifies the starting and
ending integer on the command line along with the max power to compute
for each integer. An example is included below: Example: Starting Integer: 2
Ending Integer: 4 Maximum Power to be computed: 5 Output Num Powers
(1 - 5) 2 2 4 8 16 32 3 9 27 81 243 729 4 16 64 256 1024 4096 Your program
should use the pow( ) function along with casting of this functions
arguments and output. (20 Marks)
Ans:
#include<stdio.h>
#include<math.h>
main()
{
int p,s,e,i,j,ot;
clrscr();
printf("enter starting number");
scanf("%d",&s);
printf("enter the ending number");
scanf("%d",&e);
p=s-1; //starting position
for(j=s;j<=e;j++)
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
{
for(i=p;i<=e+1;i++)
{
ot=pow(s,i);
printf("%d\t",ot);
}
s++;
printf("\n");
}
getch();
}
5. Write an interactive C program to simulate the evaluation scheme for
MCA (First semester) for 10 students. Each course should have both the
components (Assignment as well as Term End Examination).
Ans:
#include <stdio.h>
struct student
{
int roll;
char name[50];
int sub[7],assign[7];
};
void main()
{
int k,i;
struct student s[10];
clrscr();
for(i=0;i<10;i++)
{
printf("Enter name: ");
scanf("%s",s[i].name);
printf("Enter roll number: ");
scanf("%d",&s[i].roll);
for(k=0;k<=6;k++)
{
printf("Enter Term-End Marks of Sub %d=",k+1);
scanf("%d",&s[i].sub[k]);
printf("Enter Assignment of Sub %d=",k+1);
scanf("%d",&s[i].assign[k]);
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
}
}
printf("\nDisplaying Information\n");
for(i=0;i<10;i++)
{
printf("\n_____________________________________\n");
printf("Roll:%d \t Name:%s \n",s[i].roll,s[i].name);
printf("\n_____________________________________\n");
for(k=0;k<=6;k++)
{
printf("TTE MArks:%d \t Assignment:%d\n", s[i].sub[k],s[i].assign[k]);
}
}
getch();
}
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com
IGNOU Solved Assignments By http://ignousolvedassignments.com
fp=fopen("bcrypt.txt","w");
if(fp==NULL)
{
printf("file can not be open");
exit();
}
printf("enter the Text");
gets(s);
printf("\nBefore the transformation=%s\n",s);
while(*s!=NULL)
{
fputc(*s,op);
s++;
}
rewind(op);
printf("\nAfter Transformation=");
do
{
ch=fgetc(op);
if(ch>='a' && ch<='z')
ch=ch+1;
putchar(ch);
fputc(ch,fp);
}while(ch!=eof());
getch();
}
Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment
Number : : BCA(2)/011/Assignment/16-17 http://ignousolvedassignments.com