You are on page 1of 9

C program to print

table
of a given number
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
clrscr(); //to clear the screen
printf(Enter any number:);
scanf(%d,&n);
printf(Table of %d is:n,n);
for(i=1;i<=10;++i)
printf(n%d*%d=%d,n,i,n*i);
getch(); //to stop the screen
}
Sub Main()
Dim N As Integer
N=1

{
int num,i,table=0;
clrscr();
printf("Enter any number: ");
scanf("%d",&num);
for(i=1;i<=10;i++)
{
table=num*i;
printf("%d * %d = %d\n",num,i,table);
}
getch();
}

Run the program using Ctrl+F9

Output:
Enter any number: 5
5*1=5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50

While N <= 5
Console.WriteLine("1x" + N.ToString +
" = " + N.ToString)
N=N*1
N=N+1
End While
Console.Write("Press enter to
continue")
Console.ReadLine()
End Sub

C Language program to print


table of
entered number using For loop
#include<conio.h>
#include<stdio.h>
void main()

C++ Language program to


print table
of entered number using For
loop
#include<conio.h>
#include<iostream.h>
void main()
{
int num,i,table=0;
clrscr();
cout<<"Enter any number: ";
cin>>num;
for(i=1;i<=10;i++)
{
table=num*i;
cout<<num<<" * "<<i<<" =
"<<table<<endl;
}
getch();
}

Run the program using Ctrl+F9

multiplication table of a given


number

Output:

using System;

Enter any number: 7

using System.Collections.Generic;

7*1=7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 =35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63

using System.Linq;

7 * 10 = 70

Write a VB program to
accept the number
from
the user in text box
and
display multiplication
table of that number
into the list box.
Private Sub cmdClear_Click()
Text1.Text =
List1.Clear
Text1.SetFocus
End Sub
Private Sub cmdDisplay_Click()
Dim n, i As Integer
n = Val(Text1.Text)
For i = 1 To 10
List1.AddItem n * i
Next
End Sub

using System.Text;
namespace stringCont
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Number to
find Multiplication");
int num =
Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= 10; i++)
{
int r = num * i;
Console.WriteLine(r.ToString());
}
Console.Read();
}
}
}

Private Sub cmdExit_Click()


Unload Me
End Sub

Public Class Form1

Private Sub Form_Load()


List1.Clear
End Sub

ByVal e As System.EventArgs)
Handles Button1.Click

Write a program in for loop to


show

Private Sub Button1_Click(ByVal


sender As System.Object,

Dim totalMarks As Integer


totalMarks = 39

If totalMarks >= 50 Then


MsgBox("passed ") Else
MsgBox("Failed ")

Print mark-sheet of students

End Sub
End Class

/* Print the Markssheet of Students of BA Final Year*/


/* variable description
rl -> Roll No
s1 -> Subject1 Marks
s2 -> Subject2 Marks
s3 -> Subject3 Marks
t -> total
per -> percentage
nm -> name of student
div -> division */
/* linking section */
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
/*variable declaration part */
int rl,s1,s2,s3,t;
float per;
char nm[25],div[10];
clrscr();
/*reading part */
printf("Enter the Roll No : ");
scanf("%d",&rl);
printf("Enter Name
: ");
fflush(stdin);
gets(nm);
printf("Enter Three Subject Marks :\n");
scanf("%d%d%d",&s1,&s2,&s3);
/* processing part */
t=s1+s2+s3;
per=t/3.0;
if(per>=75)
strcpy(div,"Honour");
else if( per>=60)
strcpy(div,"First");
else if( per>=48)
strcpy(div,"Second");
else if (per>=36)
strcpy(div,"Pass");
else
strcpy(div,"Fail");

/* display part */
printf("\t\tUniversity of Rajasthan\n");
printf("\n\n");
printf("Roll No: %d \t Name : %s\n",rl,nm);
printf("--------------------------------------------------\n");
printf("Subject
Max
Min
Obt.Marks\n");
printf("--------------------------------------------------\n");
printf("Hist
100
36
%d\n",s1);
printf("socio.
100
36
%d\n",s2);
printf("Hindi
100
36
%d\n",s3);
printf("--------------------------------------------------\n");
printf("
Total
%d\n",t);
printf("per

%f\t\t\t

div: %s \n",per,div);

printf("--------------------------------------------------\n");
getch();
}
C# Program to Generate the Marksheet of the Student

This C# Program Generates the Marksheet of the Student. Here the student details
are obtained from the user and the marksheet is generated based on the details.

Here is source code of the C# Program to Generate the Marksheet of the Student. The C#
program is successfully compiled and executed with Microsoft Visual Studio. The program
output is also shown below.
1. /*
2. * C# Program to Generate the Marksheet of the Student
3. */
4. using System;
5. using System.Collections.Generic;
6. using System.Linq;
7. using System.Text;
8.
9. namespace Marksheet1
10. {
11.
class Program
12.
{
13.
static void Main(string[] args)
14.
{
15.
int r, m1, m2, m3, t;

16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51. }

float p;
string n;
Console.WriteLine("Enter Roll Number :");
r = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Student Name :");
n = Console.ReadLine();
Console.WriteLine("Mark of Subject1 : ");
m1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Mark of Subject2 : ");
m2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Mark of Subject3 : ");
m3 = Convert.ToInt32(Console.ReadLine());
t = m1 + m2 + m3;
p = t / 3.0f;
Console.WriteLine("Total : " + t);
Console.WriteLine("Percentage : " + p);
if (p >= 35 && p < 50)
{
Console.WriteLine("Grade is C");
}
if (p >= 50 && p <= 60)
{
Console.WriteLine("Grade is B");
}
if (p > 60 && p <= 80)
{
Console.WriteLine("Grade is A");
}
if (p > 80 && p <= 100)
{
Console.WriteLine("Grade is A+");
}
Console.ReadLine();

Here is the output of the C# Program:


Enter RollNumber :
48
Enter Student Name :
sri
Mark of Subject1 :
90
Mark of Subject2 :
80
Mark of Subject3 :
70
Total : 240
Percentage : 80
Grade is A

C-program (sequence) Mark sheet


15. Write a Program to input name, class and marks in five Subjects like
English, math, Nepali, account, Computer science Find Total, percentage,
division, remarks The condition of division is.. : Percentage / Division: per> =
75 / Distinction, per> = 60 AND per <75 / First per> = 45 AND per <60 / Second,
per> = 35 AND per <45 / Third and Below-35 / Fail.

#include <stdio.h>

#include <conio.h>
void main ()
{
char name [50];
int clas, eng, nep, math, acc, cscience, total;
float per;
printf ("Enter the name of student:");
scanf ("% s", & name);
printf ("Enter the class:");
scanf ("% d", & clas);
printf ("Enter the marks in English, Nepali, Math, Account and Computer Science.");
scanf ("% d% d% d% d% d", & eng, & nep, & math, & acc, & cscience);
printf
printf
printf
printf
printf
printf
printf
printf

("\
("\
("\
("\
("\
("\
("\
("\

t \ nName =% s", name);


t \ nClass =% d", clas);
nEnglish = \ t% d", eng);
nNepali = \ t% d", nep);
nMath = \ t% d", math);
nAccount = \ t% d", acc);
nComputer Science = \ t% d", cscience);
n ===============================");

total = eng + nep + math + acc + cscience;


per = total / 5;
printf ("Total = \ t% d", total);
printf ("Percentage = \ t% f", per);
if (eng> = 35 && nep> = 35 && math> = 35 && acc> = 35 && cscience> = 35)
printf ("\ nRemarks: PASSED");
else
printf ("\ nRemarks: FAILED");
if (per> = 75)
printf ("Division: Distnction");
else if (per> = 60 && per <75)
printf ("Division: First");
else if (per> = 45 && per <60)
printf ("Division: Second");
else if (per> = 35 && per <45)
printf ("Division: Third");
else
printf ("Division: Fail");
getch ();
}

Select Case Control Structure


In previous lesson, we have learned how to control the program flow using If...Then...ElseIf
control structure. In this chapter, you shall learn another way to control the program flow, that is,

the Select Case control structure. However, the Select Case control structure is slightly different
from the If....ElseIf control structure .
The difference is that the Select Case control structure can handle conditions with multiple
outcomes in an easier manner than the If...Then...ElseIf control structure. If...Then...ElseIf
control structure basically used to handle a single condition having more than two outcomes.
Though If...Then...ElseIf control structure may also be used compute conditions with multiple
outcomes, we need to use more than two levels of nested If...Then...ElseIf statements, this can
make it difficult to read the codes. Therefore, the Select Case control structure is preferred when
there exist many different conditions.
The format of the Select Case control structure is show below:
Select Case expression
Case value1
Block of one or more VB statements
Case value2
Block of one or more VB Statements
Case value3
.
.
Case Else
Block of one or more VB Statements
End Select
Example 8.1
Dim grade As String
Private Sub Compute_Click( )
grade=txtgrade.Text
Select Case grade
Case "A"
result.Caption="High Distinction"
Case "A-"
result.Caption="Distinction"
Case "B"
result.Caption="Credit"
Case "C"
result.Caption="Pass"
Case Else
result.Caption="Fail"
End Select
End Sub
Example 8.2
Dim mark As Single
Private Sub Compute_Click()
'Examination Marks
mark = mrk.Text
Select Case mark

Case Is >= 85
comment.Caption = "Excellence"
Case Is >= 70
comment.Caption = "Good"
Case Is >= 60
comment.Caption = "Above Average"
Case Is >= 50
comment.Caption = "Average"
Case Else
comment.Caption = "Need to work harder"
End Select
End Sub
Example 8.3

Example 8.2 can be rewritten as follows:


Dim mark As Single
Private Sub Compute_Click()
'Examination Marks
mark = mrk.Text
Select Case mark
Case 0 to 49
comment.Caption =" Need to work harder"
Case 50 to 59>/p>
comment.Caption = "Average"
Case 60 to 69
comment.Caption = "Above Average"
Case 70 to 84
comment.Caption = "Good"
Case Else
comment.Caption = "Excellence"
End Select
End Sub
WAP to Find Factorial of a Number Using Recursion Function
WAP to Count Number of Vowels in a String
WAP to Find the Number is Positive or Negative Using Friend Function

Download Files from Scribd for Free


As we all know well about Scribd, which is probably the best site to get some documents.
Though there are many other sites where one can view or download documents for free. exwww.brupt.com, www.slideshare.net etc.
Its not necessary that we get our desired file on free sites and as Scribd is either paid or you
have to upload a document to download one. Before going ahead let me share my own
experience.
Its been a hell of a day looking for some useful document to prepare my college project and
after going through many free sites I ended up nothing in my hand so decided to Google
about, How to download files free from www.scribd.com. Again the result was same, most of
the sites asked me to install a software or an extension but none of them worked, so finally I
had to upload one file to download one file from Scribd.
It was ok with me until I had to get 2-3 files but my requirement was of 25-30 files, now the
problem started as I wasn't ready to upload my precious documents on scribd or even to
waste my time uploading and filling details for document and then download the desired file.
After uploading my first document when I started downloading the file, that was where I saw

how to download for free without any upload which was very simple and worked every time
with me.
Here am going to share how it all works,

1.Login from your facebook account


2. Search the file and open it.
3. Look at the address bar, there you will something like this
( http://www.scribd.com/doc/63875906/indigeek-blogs )
4. Now just put #download at the end and press enter or go.
5. Your download starts.
In any case if the above procedure doesn't works then you can try this process:
1) Go to scribd.com, search for the document you want and open it.
2) Right-click anywhere on the page and click view page source.
3) Search for access_key, once you find it copy it to some place. (Press ctrl-f and type
access_key,you will find this kind of key "access_key":"key-1555z9ggumh3nb977n97 the

highlighted part is access key)


4) Get the document id of the documents that you want to download. Document ID is written in the
URL of document.
5) Replace access_key and document id in this url
http://d1.scribdassets.com/ScribdViewer.swf?document_id=108992419&access_key=key13davbcdewnewn9m5w02
And paste the modified url in a new browser window.Once the file appears, you can download it, if
the download option does not appears then click print option and save it as pdf or onenote file.

You might also like