When we install both Ubuntu and XP in our system.It'll herritate us by going into Ubuntu when we reboot the system.
So to overcome from this,we have to set XP as default O.S..To do this,we have to change a small setting in Ubuntu.
Type this command in command line:
sudo gedit /boot/grub/menu.lst
(search where grub folder located).If you don't have gedit(notepad) in Kubuntu.To install the gedit type this command in terminal:
sudo kate /boot/grub/menu.lst
Then press Enter.One text document opens when we press Enter.In that document these lines will be located:
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0
When we reboot the system,have to see at which line XP placed along with Ubuntu.Next we have to paste the XP Number in last line(default 0) in document means We should Enter the XP number that we we have seen when the system booting,instead of "0".Later save the the doucument and close it and restart the system.
Naturally Kubuntu and Ubuntu has booting number "6".So we have to Enter "6"instead of "0"in the document last line.i.e.default 6 in last line of document.
Saturday, December 11, 2010
Sunday, November 28, 2010
Write a program toAsk student to Enter his roll number ,three subject marks obtained by Roll no.1 and repeat it for3timesAndprint them
#include
#include
int main()
{
int result [3][4];
int i, j;
for (i=0;i<3;i++)
{
j=0;
printf ("\nEnter the Roll number:-");
scanf ("%d", &result [i][j]);
for (j=1;j<4;j++)
{
printf ("\nEnter the marks of subject no.%2d\n", j);
scanf ("%d", &result [i][j]);
}
}
printf ("The stored values are:\n");
for (i=0;i<3;i++)
{
for (j=0;j<4;j++)
{
printf ("%4d", result [i][j]);
}
printf ("\n");
}
getch ();
}
#include
int main()
{
int result [3][4];
int i, j;
for (i=0;i<3;i++)
{
j=0;
printf ("\nEnter the Roll number:-");
scanf ("%d", &result [i][j]);
for (j=1;j<4;j++)
{
printf ("\nEnter the marks of subject no.%2d\n", j);
scanf ("%d", &result [i][j]);
}
}
printf ("The stored values are:\n");
for (i=0;i<3;i++)
{
for (j=0;j<4;j++)
{
printf ("%4d", result [i][j]);
}
printf ("\n");
}
getch ();
}
Labels:
C-Programming
Write a program to print the values in a matrix table
#include
#include
main()
{
int a[10][10],i,j,r,c;
printf("Enter order or matrix:");
scanf("%d%d", &r,&c);
printf("Enter %d values ", r*c);
for(i=0;i
for(j=0;j
scanf("%d", &a[i][j]);
printf("\n Element of array a: ");
for(i=0;i
{
printf("\n");
for(j=0;j
{
printf("%d\t",a[i][j]);
}
}
getch();
}
#include
main()
{
int a[10][10],i,j,r,c;
printf("Enter order or matrix:");
scanf("%d%d", &r,&c);
printf("Enter %d values ", r*c);
for(i=0;i
for(j=0;j
scanf("%d", &a[i][j]);
printf("\n Element of array a: ");
for(i=0;i
{
printf("\n");
for(j=0;j
{
printf("%d\t",a[i][j]);
}
}
getch();
}
Labels:
C-Programming
Write a program to print the highest score of the given array?
#include
#include
#define NUM_STUDENTS 25
#define NUM_TESTS 10
int get_highest(int a[][NUM_TESTS], int row, int col);
int main()
{
int grades[NUM_STUDENTS][NUM_TESTS] = { {55, 60, 65},
{85, 90, 95} };
int num_students = 2;
int num_tests = 3;
int high_test;
high_test = get_highest( grades, num_students, num_tests);
printf("The highest score is %d.\n", high_test);
getch();
}
int get_highest(int a[][NUM_TESTS], int row, int col)
/* Assumes that there is at least one element */
{
int i, j;
int highest = a[0][0];
for( i = 0; i < row; i++)
for( j = 0; j < col; j++)
if ( a[i][j] > highest)
highest = a[i][j];
return highest;
}
#include
#define NUM_STUDENTS 25
#define NUM_TESTS 10
int get_highest(int a[][NUM_TESTS], int row, int col);
int main()
{
int grades[NUM_STUDENTS][NUM_TESTS] = { {55, 60, 65},
{85, 90, 95} };
int num_students = 2;
int num_tests = 3;
int high_test;
high_test = get_highest( grades, num_students, num_tests);
printf("The highest score is %d.\n", high_test);
getch();
}
int get_highest(int a[][NUM_TESTS], int row, int col)
/* Assumes that there is at least one element */
{
int i, j;
int highest = a[0][0];
for( i = 0; i < row; i++)
for( j = 0; j < col; j++)
if ( a[i][j] > highest)
highest = a[i][j];
return highest;
}
Labels:
C-Programming
Write a program to find out the largest and smallest values of a Matrix?
#include
#include
main()
{
int a[10][10];
int l,s,i,j,p,q;
printf("Enter the order of matrix: ");
scanf("%d%d", &p,&q);
printf("\n Enter %d values : ",p*q);
for(i=0;i
{
for(j=0;j
scanf("%d", &a[i][j]);
}
l=0;
s=a[0][0];
for(i=0;i
{
for(j=0;j
{
if(l
l=a[i][j];
if(a[i][j]
s=a[i][j];
}
}
printf("\n\n");
printf("Element of matrix a: ");
for(i=0;i
{
printf("\n");
for(j=0;j
{
printf("%d\t", a[i][j]);
}
}
printf("\n The biggest values: %d", l);
printf("\n The smallest value:%d",s);
getch();
}
#include
main()
{
int a[10][10];
int l,s,i,j,p,q;
printf("Enter the order of matrix: ");
scanf("%d%d", &p,&q);
printf("\n Enter %d values : ",p*q);
for(i=0;i
{
for(j=0;j
scanf("%d", &a[i][j]);
}
l=0;
s=a[0][0];
for(i=0;i
{
for(j=0;j
{
if(l
l=a[i][j];
if(a[i][j]
s=a[i][j];
}
}
printf("\n\n");
printf("Element of matrix a: ");
for(i=0;i
{
printf("\n");
for(j=0;j
{
printf("%d\t", a[i][j]);
}
}
printf("\n The biggest values: %d", l);
printf("\n The smallest value:%d",s);
getch();
}
Labels:
C-Programming
Write a program to read data and determine the following ,Total marks obtain by each student,The highest marks in each subject with Rollno, highest st
#include
int main()
{
int result[10][5],i,j,k,total,maxr,maxm;
for(i=0;i<5;i++) {
total=0;
for(j=0;j<4;j++)
{
if(j==0)
puts("Enter Roll number\t");
else if(j==1)
puts("Enter 1st subject marks\t");
else if(j==2)
puts("Enter 2nd subject marks\t");
else if(j==3)
puts("Enter 3rd subject marks\t");
scanf("%d",&result[i][j]);
if(j!=0)
total+=result[i][j];
}
result[i][j]=total;
}
puts("Mark sheet");
printf("\n%6s%6s%6s%6s%6s\n","Roll","1st","2nd","3rd","Total");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("%6d",result[i][j]);
} printf("\n");
}
puts("Press any key....");
getch();
puts("Roll number with total");
printf("\n%6s%6s\n","Roll","Total");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{ if((j==0)||(j==4))
printf("%6d",result[i][j]);
}
printf("\n");
}
for(i=1;i<4;i++)
{
for(j=0;j<5;j++)
{
if(j==0)
{
maxm=result[j][i];
maxr=result[j][0];
}
else if(result[j][i]>maxm)
{
maxm=result[j][i];
maxr=result[j][0];
}
}
if(i==1)
printf("\nMaximum marks in sub1 is %d, Roll number %d",maxm,maxr);
else if(i==2)
printf("\nMaximum marks in sub2 is %d, Roll number %d",maxm,maxr);
else if(i==3)
printf("\nMaximum marks in sub3 is %d, Roll number %d",maxm,maxr);
}
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(j==4)
{
if(i==0)
{
maxm=result[i][j];
maxr=result[i][0];
}
else if(result[i][j]>maxm)
{
maxm=result[i][j];
maxr=result[i][0];
}
}
}
}
printf("\nMaximum total is %d and Roll number %d",maxm,maxr);
getch();
}
int main()
{
int result[10][5],i,j,k,total,maxr,maxm;
for(i=0;i<5;i++) {
total=0;
for(j=0;j<4;j++)
{
if(j==0)
puts("Enter Roll number\t");
else if(j==1)
puts("Enter 1st subject marks\t");
else if(j==2)
puts("Enter 2nd subject marks\t");
else if(j==3)
puts("Enter 3rd subject marks\t");
scanf("%d",&result[i][j]);
if(j!=0)
total+=result[i][j];
}
result[i][j]=total;
}
puts("Mark sheet");
printf("\n%6s%6s%6s%6s%6s\n","Roll","1st","2nd","3rd","Total");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("%6d",result[i][j]);
} printf("\n");
}
puts("Press any key....");
getch();
puts("Roll number with total");
printf("\n%6s%6s\n","Roll","Total");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{ if((j==0)||(j==4))
printf("%6d",result[i][j]);
}
printf("\n");
}
for(i=1;i<4;i++)
{
for(j=0;j<5;j++)
{
if(j==0)
{
maxm=result[j][i];
maxr=result[j][0];
}
else if(result[j][i]>maxm)
{
maxm=result[j][i];
maxr=result[j][0];
}
}
if(i==1)
printf("\nMaximum marks in sub1 is %d, Roll number %d",maxm,maxr);
else if(i==2)
printf("\nMaximum marks in sub2 is %d, Roll number %d",maxm,maxr);
else if(i==3)
printf("\nMaximum marks in sub3 is %d, Roll number %d",maxm,maxr);
}
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(j==4)
{
if(i==0)
{
maxm=result[i][j];
maxr=result[i][0];
}
else if(result[i][j]>maxm)
{
maxm=result[i][j];
maxr=result[i][0];
}
}
}
}
printf("\nMaximum total is %d and Roll number %d",maxm,maxr);
getch();
}
Labels:
C-Programming
Write a program that reads in four integers and determines and prints the largest and the smallest integers in the group?
#include
#include
#define MAX_INTS 4
int main()
{
int min = INT_MAX;
int max = INT_MIN;
int a[ MAX_INTS ];
int i;
for (i = 0; i < MAX_INTS; i++)
{
printf( "Enter number %d of %d : ", (i + 1), MAX_INTS);
scanf( "%d", &a[i] );
if ( a[i] < min) min = a[i];
if ( a[i] > max) max = a[i];
}
printf("%d is the smallest number\n", min);
printf("%d is the largest number\n", max);
return 0;
}
#include
#define MAX_INTS 4
int main()
{
int min = INT_MAX;
int max = INT_MIN;
int a[ MAX_INTS ];
int i;
for (i = 0; i < MAX_INTS; i++)
{
printf( "Enter number %d of %d : ", (i + 1), MAX_INTS);
scanf( "%d", &a[i] );
if ( a[i] < min) min = a[i];
if ( a[i] > max) max = a[i];
}
printf("%d is the smallest number\n", min);
printf("%d is the largest number\n", max);
return 0;
}
Labels:
C-Programming
Write the program to calculate the Median of a given array
#include
main()
{
int i,j,n;
float median,t;
printf("Enter the size of the array\n");
scanf("%d",&n);
float a[n];
printf("Enter the values\n");
for(i=0;i
scanf("%f",&a[i]);
for(i=0;i
{
for(j=1;j
{
if(a[j-1]
{
t=a[j-1];
a[j-1]=a[j];
a[j]=t;
}
else
continue;
}
}
if(n%2==0)
median=(a[n/2]+a[n/2+1])/2;
else
median=a[n/2+1];
for(i=0;i
printf(" %.2f",a[i]);
printf("\nMedian is =%f\n",median);
getch();
}
main()
{
int i,j,n;
float median,t;
printf("Enter the size of the array\n");
scanf("%d",&n);
float a[n];
printf("Enter the values\n");
for(i=0;i
scanf("%f",&a[i]);
for(i=0;i
{
for(j=1;j
{
if(a[j-1]
{
t=a[j-1];
a[j-1]=a[j];
a[j]=t;
}
else
continue;
}
}
if(n%2==0)
median=(a[n/2]+a[n/2+1])/2;
else
median=a[n/2+1];
for(i=0;i
printf(" %.2f",a[i]);
printf("\nMedian is =%f\n",median);
getch();
}
Labels:
C-Programming
write a program to Reverse the digits by using do-while loop
#include
#include
main()
{
int number = 123;
int rightMostNumber = 0;
int temp = 0;
temp = number;
do
{
rightMostNumber = 10*rightMostNumber + temp % 10;
temp = temp/10;
} while (temp);
printf ("\nThe number %d reversed is %d\n", number, rightMostNumber );
getch();
}
#include
main()
{
int number = 123;
int rightMostNumber = 0;
int temp = 0;
temp = number;
do
{
rightMostNumber = 10*rightMostNumber + temp % 10;
temp = temp/10;
} while (temp);
printf ("\nThe number %d reversed is %d\n", number, rightMostNumber );
getch();
}
Labels:
C-Programming
write a program to find given number is palidrome or not by using while loop?
#include
#include
main()
{
int n,t,s,r;
printf(“Ent er any number:”);
scanf(“%d”,&n);
t=n;
s=0;
while (n>0)
{
r=n%10;
s=(s*10)+r;
n=n/10;
}
if(t==s)
printf(“%d is a Palindrome number”, t);
else
printf(“%d is not a Palindrome number”, t);
getch();
}
#include
main()
{
int n,t,s,r;
printf(“Ent er any number:”);
scanf(“%d”,&n);
t=n;
s=0;
while (n>0)
{
r=n%10;
s=(s*10)+r;
n=n/10;
}
if(t==s)
printf(“%d is a Palindrome number”, t);
else
printf(“%d is not a Palindrome number”, t);
getch();
}
Labels:
C-Programming
Subscribe to:
Posts (Atom)