Skip to main content

Posts

Showing posts from March, 2017

Write a program to check the number is prime or not

//Write a program to check the number is prime or not #include <stdio.h> #include <conio.h> void main() { int i,n,count=0; clrscr(); printf( "Enter any number:\n" ); scanf( "%d" ,&n); for (i=2;i<=n/2;i++) { if (n%i==0) { count++; break ; } } if (coutn==0) printf( "%d is prime number" ,n); else printf( "%d is not prime number" ,n); getch(); }

Write a program to calculate n term of Fibonacci series using for loop 0,1,1,2,3,5,8.....

//Write a program to calculate n term of Fibonacci series using for loop 0,1,1,2,3,5,8,..... #include <stdio.h> #include <conio.h> void main() { int n,i,a,b,c=0; clrscr(); printf( "Enter value of n:" ); scanf( "%d" ,&n); a=0; b=1; if (n=1) printf( "0" ); else if (n>=2) { printf( "0,1" ); for (i=1;i<n-1;i++) { c=a+b; printf( "%d" ,c); a=b; b=c; } } getch(); }

Write a program to calculate factorial of any number

//Write a program to calculate factorial of any number #include <stdio.h> #include <conio.h> void main() { int i,n,fact=1; clrscr(); printf( "Enter any number:\n" ); scanf( "%d" ,&n); for (i=1;i<=n;i++) { fact = fact * i; } printf( "Factorial of %d = %d" ,n,fact); getch(); } /*if input number is 4 then 1x2 1x2x3 1x2x3x4 output is 24*/

Write a program to print sum of all number between 100 to 350 which is divisible by 9

//Write a program to print sum of all number between 100 to 350 which is divisible by 9 #include <stdio.h> #include <conio.h> void main() { int i,sum=0; clrscr(); for (i=100;i<=350;i=++) //run loop from 100 to 350 { if (i%9==0) //add only if the number is divisible by 9 { sum = sum + i; } } printf( "Sum = %d" ,sum); getch(); }

Write a program to print series of n term of natural number & also find sum using for loop

//Write a program to print series of n term of natural number & also find sum using for loop #include <stdio.h> #include <conio.h> void main() { int i,n,sum=0; clrscr(); printf( "Enter any term of number:\n" ); scanf( "%d" ,&n); for (i=1;i<=n;i++) { printf( "%d" ,i); sum=sum+i; } printf( "Sum = %d" ,sum); getch(); }

Write a program to check a number is palindrom or not

//Write a program to check a number is palindrom or not #include <stdio.h> #include <conio.h> void main() { int n,a,r=0,temp; clrscr(); printf( "Enter any number:\n" ); scanf( "%d" &n); temp = n; // copy number to temp while (n) //run loop until n have some value { a=n%10; //from this we get last digit r=r*10+a; n=n/10; } if (temp==r) printf( "%d is Palindrom" ,temp); else printf( "%d is not Palindrom" ,temp); getch(); } /*For example we input a number 121 then a = 121%10 = 1 r = 0*10 + 1 = 1 n = 121/10 = 12 a = 12%10 = 2 r = 1*10 + 2 = 12 n = 12/10 = 1 a = 1%10 = 1 r = 12*10 + 1 = 121 n = 1/10 = 0 temp is equal to r, so that 121 is Palindrom*/

Write a program to print reverse number of given number using while loop

//Write a program to print reverse number of given number using while loop #include <stdio.h> #include <conio.h> void main() { int n,a,r=0; clrscr(); printf( "Enter any number:\n" ); scanf( "%d" &n); while (n) //run loop until n have some value { a=n%10; //from this we get last digit r=r*10+a; n=n/10; } printf( "Reverse = %d" ,r); getch(); } /*For example we input a number 123 then a = 123%10 = 3 r = 0*10 + 3 = 3 n = 123/10 = 12 a = 12%10 = 2 r = 3*10 + 2 = 32 n = 12/10 = 1 a = 1%10 = 1 r = 32*10 + 1 = 321 n = 1/10 = 0 while n become zero while loop stop then print r=321 which is reverse of 123.*/

Write a program to print 4,7,10,13,.........less than 50 using while looping

//Write a program to print 4,7,10,13,.........less than 50 using while looping #include <stdio.h> #include <conio.h> void main() { int x=4; //set x= 4 because according to question, we have to start from 4 clrscr(); while (x<50) //run the loop while x is less than 50 { printf( "%d\n" ,x); x=x+3; //because 7-4=3, 10-7=3, 13-10=3,..... } getch(); }

Write a program to print multiplication table of any number using while looping.

//Write a program to print multiplication table of any number using while looping. #include <stdio.h> #include <conio.h> void main() { int x=1,n; clrscr(); printf( "Enter any number:\n" ); scanf( "%d" ,&n); while (x<=10) //Multiple 35 by 2 because because upto 70 there is 35 odd numbers and 35 even numbers { printf( "%dx%d=%d" ,n,x,n*x); //Eg : nx1, nx2, nx3, ..... x++; //increase x by 1 } getch(); }

Write a program to print even square series upto 50 term using while looping

//Write a program to print even square series upto 50 term using while looping. #include <stdio.h> #include <conio.h> void main() { int x=2; clrscr(); while (x<=100) //Multiple 35 by 2 because because upto 70 there is 35 odd numbers and 35 even numbers { printf( "%d" ,x*x); //Eg : 2x2, 3x3, 4x4, ..... x=x+2; //Eg : 2+2=4, 4+2=6, 6+2=8, ...... } getch(); }

Write a program to print 1 to 50 term of natural number & sum by using while loop

//Write a program to print 1 to 50 term of natural number & sum by using while loop #include <stdio.h> #include <conio.h> void main() { int x=1,sum=0; clrscr(); while (x<=50) //While loop run if the condition remains true { printf( "%d" ,x); sum = sum + x; x=x+1; } printf( "Sum = %d" ,sum); //Sum is printed at the last getch(); }

Write a program to enter 1 to 7 case and display day of week.

//Write a program to enter 1 to 7 case and display day of week. #include <stdio.h> #include <conio.h> void main() { int day; clrscr(); printf( "Enter number between 1 to 7" ); scanf( "%d" ,&day); switch (day) { case 1:printf( "Sunday" ); break ; case 2:printf( "Monday" ); break ; case 3:printf( "Tuesday" ); break ; case 4:printf( "Wednesday" ); break ; case 5:printf( "Thusday" ); break ; case 6:printf( "Friday" ); break ; case 7:printf( "Saturday" ); break ; default :printf( "Invalid input" ); } getch(); }

Write a program to check largest number among three number by using Nested if else

//Write a program to check largest number among three number by using Nested if else #include <stdio.h> #include <conio.h> void main() { int a,b,c; clrscr(); printf( "Enter any three number:\n" ); scanf( "%d%d%d,&a&b&c" ); if (a>b) { if (a>c) printf( "Largest=%d" ,a); else printf( "Largest=%d" ,c);} else { if (b>c) printf( "Largest=%d" ,b); else printf( "Largest=%d" ,c);} getch(); }

CTEVT II/I (2073) Engineering Mathematics-III

CTEVT 2nd Year/ 1st Part Subject : Engineering Mathematics-III Year : 2073 Program : Diploma in Computer / IT Eng. (New) Page contain : 2

CTEVT II/I (2073) Web Technology & Programming II

CTEVT 2nd Year/ 1st Part Subject : Web Technology & Programming II Year : 2073 Program : Diploma in Computer / IT Eng. (New) Page contain : 1

CTEVT II/I (2073) Data Structure & Algorithm

CTEVT 2nd Year/ 1st Part Subject : Data Structure & Algorithm Year : 2073 Program : Diploma in Computer / IT Eng. (New) Page contain : 1

CTEVT II/I (2073) Electronic Device & Circuits

CTEVT 2nd Year/ 1st Part Subject : Electronic Device & Circuits Year : 2073 Program : Diploma in Computer / IT Eng. (New) Page contain : 1

CTEVT II/I (2073) Visual Programming

CTEVT 2nd Year/ 1st Part Subject : Visual Programming Program : Diploma in Computer / IT Eng. Visual Programming - 2073 - Regular/Back 1. What is IDE? Explain various element of visual basic. [2+6=8] 2. (a) What do you mean by "Event driven programming"? [3]     (b) What is Recursion? Define procedure and it's types? [5] 3. Design and WAP code to read any three numbers and find biggest number. [8] 4. What is Active x control used for? Explain with example. [8] 5. What do you mean by co-ordinate system? Explain the methods used to draw line, circle and specifying color in VB. [8] 6. Differentiate betwee: Any Two [2x4=8]     (a) Image box and picture box.     (b) Checkbox and option button.     (c) List box and combo box. 7. Define visual data manager. Write down the steps to connect the database using ADODC. [8] 8. Design an interface to ask the "Name and age" of five different student and process the average age. Also write VB...

Microprocessors Exam Paper

CTEVT 2nd Year/ 1st Part Subject : Microprocessors Program : Diploma in Computer / IT Eng. Microprocessors - 2073 - Regular/Back 1. (a) Different between Analog & Digital computer and explain Microprocessors & microcontroller. [8]     (b) What is addressing mode? Expalin the addressing modes in 8085 with suitable example. [8] 2. (a) Draw the neat and clean internet architecture of 8085 and explain briefly. [6+10] 3. (a) Write an assembly language program: Add two 8-bits numbers 09H and 04H and the substract with 33H and store result in memory location 2073H. [8]     (b) Write a program to add ten numbers in consecutive momory location starting from 4081H and display the result in two output ports. [8] 4. (a) Draw the timing diagram of memory read cycle in 8085 and explain in detail. [8]     (b) Define the Unique address decoding. Interface 8 KB ROM Memory with 8085 microprocessor. [2+6] 5. (a) What is DMA? Explain about the oper...