Sunday, 3 May 2020

Program to display a matrix.

#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][2],b[3][2],i,j;
clrscr();
printf(“enter value for for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
scanf(“%d”,&a[i][j]);
}
printf(“enter value for b matrix: ”);
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
scanf(“%d”,&b[i][j]);
}
printf(“\na matrix is\n\n”);
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
  {
printf(“ %d ”,a[i][j]);
}
printf(“\n”);
}
printf(“\nb matrix is\n\n”);
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
printf(“ %d ”,b[i][j]);
}
printf(“\n”);
}
getch();
}

The annual examination result of 50 students in a class is tabulated in a Single Dimensional Array (SDA) is as follows:

Write a program to read the data, calculate and display the following:
(a) Average marks obtained by each student.
(b) Print the roll number and the average marks of the students whose average is above.
80.
(c) Print the roll number and the average marks of the students whose average is below
40.


import java.util.Scanner;
public class ATS
{
public static void main(String[]args)
{
final int TOTAL_STUDENTS = 50;
Scanner in = new Scanner(System.in);
int rollNo[] = new int[TOTAL_STUDENTS];
int sA[] = new int[TOTAL_STUDENTS];
int sB[] = new int[TOTAL_STUDENTS];
int sC[] = new int[TOTAL_STUDENTS];
double avg[] = new double[TOTAL_STUDENTS];
for (int i = 0; i < TOTAL_STUDENTS; i++)
{
System.out.println("Enter student " + (i+1) + " details:");
System.out.print("Roll No: ");
rollNo[i] = in.nextInt();
System.out.print("Subject A Marks: ");
sA[i] = in.nextInt();
System.out.print("Subject B Marks: ");
sB[i] = in.nextInt();
System.out.print("Subject C Marks: ");
sC[i] = in.nextInt();
avg[i] = (sA[i] + sB[i] + sC[i]) / 3.0;
}
System.out.println("\nRoll No\tAverage Marks");
for (int i = 0; i < TOTAL_STUDENTS; i++)
{
System.out.println(rollNo[i] + "\t" + avg[i]);
}
System.out.println("\nStudents with Average above 80:");
for (int i = 0; i < TOTAL_STUDENTS; i++)
{
if (avg[i] > 80)
System.out.println(rollNo[i] + "\t" + avg[i]);
}
System.out.println("\nStudents with Average below 40:");
for (int i = 0; i < TOTAL_STUDENTS; i++)
{
if (avg[i] < 40)
System.out.println(rollNo[i] + "\t" + avg[i]);
}
}

Write a program showing implementation of stack class having the functionality of push, pop operations.

#include<iostream.h>
#define MAX 10
class stack
{
private:
int arr[ MAX ], top;
public:
stack( )
{
top = -1;
}
void push( int item )
{
if( top == MAX - 1 )
{
cout << endl << "Stack is full";
return;
}
top++;
arr[ top ] = item;
}
int pop( )
{
if( top == -1 )
{
cout << endl << "Stack is empty";
return NULL;
}
int data = arr[ top ];
top--;
return data;
}
};
void main( )
{
stack s;
s.push( 11 );
s.push( 12 );
s.push( 13 );
s.push( 14 );
s.push( 15 );
s.push( 16 );
s.push( 17 );
s.push( 18 );
s.push( 19 );
s.push( 20 );
s.push( 21 );
int i = s.pop( );
cout << endl << "Item popped=" << i;
i = s.pop( );
cout << endl << "Item popped=" << i;
i = s.pop( );
cout << endl << "Item popped=" << i;
i = s.pop( );
cout << endl << "Item popped=" << i;
}

Friday, 1 May 2020

WAP to find the maximum in an array

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],max,i;
clrscr();
printf(“enter element for the array: ”);
for(i=0;i<5;i++)
scanf(“%d”,&a[i]);
max=a[0];
for(i=1;i<5;i++)
{
if(max<a[i])
max=a[i];
}
printf(“maximum no= %d”,max);
getch();
}

Write a program to accept 10 different decimal numbers (double data type) in a Single Dimensional Array (say, A). Truncate the fractional part of each number of the array A and store their integer part in another array (say, B).

import java.util.Scanner;
public class ATS
{
public static void main(String[]args)
{
Scanner in = new Scanner(System.in);
double a[] = new double[10];
int b[] = new int[10];
System.out.println("Enter 10 decimal numbers");
for (int i = 0; i < a.length; i++)
{
a[i] = in.nextDouble();
b[i] = (int)a[i];
}
System.out.println("Truncated numbers");
for (int i = 0; i < b.length; i++)
{
System.out.print(b[i] + ", ");
}
}
}

Write a Program for reading and writing data to and from the file using command line arguments.

#include<iostream.h>
#include<fstream.h>
#include<stdlib.h>
int main(int argc, char *argv[])
{
int number[9] = {11,22,33,44,55,66,77,88,99};
if(argc!=3)
{
cout<<"argc="<<argc<<"\n";
cout<<"Error in arguments\n";
exit(1);
}
ofstream fout1, fout2;
fout1.open(argv[1]);
if(fout1.fail())
{
cout<<"Could not open the file:"
<<argv[1]<<"\n";
exit(1);
}
fout2.open(argv[2]);
if(fout2.fail())
{
cout<<"Could not open the file:"
<<argv[2]<<"\n";
exit(1);
}
for(int i=0; i<9; i++)
{
if(number[i] % 2 == 0)
fout2<<number[i]<<" ";
else
fout1<<number[i]<<" ";
}
fout1.close();
fout2.close();
ifstream fin;
char ch;
for(i=1; i<argc; i++)
{
fin.open(argv[i]);
cout<<"Contents of "<<argv[i]<<"\n";
do
{
fin.get(ch);
cout<<ch;
}while(fin);
cout<<"\n\n";
fin.close();
}
return 0;
}

How to Learn Hindi Typing in 5 Minutes



How to Learn Hindi Typing in 5 Minutes :
5 मिनिट में हिंदी टाइपिंग करना सीखे :
दोस्तों आज और अब मै आपको हिंदी टाइपिंग सीखने का आसान तरीका बताऊंगा , अब आप इस आर्टिकल को पढने के बाद फटाफट हिंदी टाइपिंग सीख पायेंगे| पहले गूगल की साईट पर ही यह व्यवस्था थी जिससे हम आसानी से हिंदी टाइपिंग कर  सकते थे, पर अब गूगल ने यह टूल वहां हटा लिया है| लेकिन आप फ़िक्र न करे हम आपकी समस्या को समझते है और आपको बातायेंगे कई आप 5 मिनिट में हिंदी टाइपिंग कैसे करें|
गूगल हिंदी इनपुट टूल ( Google Hindi Input Tool) एक ऐसा सॉफ्टवेर है जिससे हम आसानी से हिंदी टाइपिंग कर सकते है| आप निचे लिखे हुए steps को करते जाये और गूगल हिंदी इनपुट टूल ( Google Hindi Input Tool) को डाउनलोड (Download) करले|
स्टेप-१ : सबसे पहले नीचे दिए लिंक से सॉफ्टवेर को डाउनलोड करे|
(step-1) : Download the software from given Link ,





स्टेप-२ : अब इस सोफ्टवेयर को अनज़िप (unzip / extract) करले |
(step-2) : Extract the Download software ,

स्टेप-3 : अब  इस पहले सॉफ्टवेर को इन्स्टाल करले |
(Step-3): Now Install First Software

स्टेप ४: अब  इस दूसरे सॉफ्टवेर को इन्स्टाल करले |
(Step-4): Now Install Second Software


स्टेप -5 : अब आपको एक न्य icon , taskbaar में मिलेगा , उसे खोल ले |
(Step-5): Now you will find the icon in task bar.


स्टेप- ६: इसमें हिंदी गूगल इनपुट टूल को सेलेक्ट करे|
(Step-6): Now Select th Hindi Input Tools.\


स्टेप-७: अब आप किसी भी सॉफ्टवेर में हिंदी में टाइप कर सकते है|
(Step-7): Now you can type anything in the MS word or any other software of typing.


आपको यदि पोस्ट से फायदा हुआ हो या अच्छी लगी हो तो कमेंट्स जरूर करे|
धन्यवाद|

इनमे आपने सिखा कि: हिंदी टाइपिंग सीखने के लिए अब आसान तरीका, हिंदी टाइपिंग सीखने कई ट्रिक, हिंदी टाइपिंग कैसे सीखी जाती है, हिंदी में टाइपिंग कैसे करे , हिंदी टाइपिंग जल्दी कैसे सीखे