Posts

Swapping of Two number

Image
C Program to Swapping of Two number #include<conio.h> #include<stdio.h> void main() {     int num1,num2,temp=0;     clrscr();     printf("Enter first number : ");     scanf("%d",&num1);     printf("Enter second number : ");     scanf("%d",&num2);     printf("\n\nValue of A: %d   and  Value of B: %d",num1,num2);     temp=num1;     num1=num2;     num2=temp;     printf("\n\n\n After swaping \n\n");     printf("Value of A: %d   and  Value of B: %d",num1,num2);     getch(); } out put

Swapping two number without 3rd variable

Image
C Program to Swapping two number without 3rd variable #include<conio.h> #include<stdio.h> void main() {     int num1,num2;     clrscr();     printf("Enter first number : ");     scanf("%d",&num1);     printf("Enter second number : ");     scanf("%d",&num2);     printf("\n\nValue of A: %d   and  Value of B: %d",num1,num2);     num1=num2+num1;     num2=num1-num2;     num1=num1-num2;     printf("\n\n\n After swaping \n\n");     printf("Value of A: %d   and  Value of B: %d",num1,num2);     getch(); } out put:

Print table of any number

Image
C Program to Print table of any number #include<conio.h> #include<stdio.h> void main() {     int n ,i;     clrscr();     printf("Enter Number for Table print: ");     scanf("%d",&n);     for(i=1;i<=10;i++)     {         printf("\n %d x %d = %d",n,i,n*i);     }     getch(); } out put :  

Add two integer numbers with user input

Program to add two integer numbers and give number at run-time #include<conio.h> #include<stdio.h> void main() { int number1, number 2; clrscr(); printf("Enter First Integer number : "); scanf("%d", &number1); printf("Enter Second Integer number : "); scanf("%d", &number2); printf( " Sum of %d and %d is %d" ,number1,number2,number1+number1); getch(); }

Addition of Two number.

Program to add two numbers #include<conio.h> #include<stdio.h> void main() { printf("Sum of Two number 5 and 8 are : " 5 + 8); getch(); }

User Input

Program to give in put through keyboard or Program to give input at run time #include<conio.h> #include<stdio.h> void main() { char name; clrscr(); printf("enter your name : "); scanf("%s ",& name); getch(); } OutPut enter your name : BRIJESH

Hello world

FIRST PROGRAM THE WORLD STARTS.. #include<conio.h> #include<stdio.h> void main() { printf("HELLO WORLD THIS IS MY FIRST PROGRAM"); getch(); } output: HELLO WORLD THIS IS MY FIRST PROGRAM

SKILL ROCKS TECH SECOND QUESTIONS ANSWER

Q2 find the greatest no. from an array having random numbers of 100 size, with out sorting. int biggest = ar[0]; for(i=0;i<100;i++) {          if(biggest <ar[i])          biggest=ar[i]; } cout<< " greatest no. of array :"<<ar[i];

SKILL ROCKS TECH THIRD QUESTION ANSWER

Q3 find the frequency of 1 to 9 from an array of size 100 having value 1 to 9 randomly arranged Conditions: 1. use only one loop. 2. do not use counters. 3. most efficiently  Answer suppose if array of 100 with random values between 1 to 9 were given then  simply answer is for(i=0;i<100;i++) {           count[ arr[i] ]++; // arr[i] is given array and count[] is frequency counter. } complete program is like this #include<conio.h> #include<iostream.h> #include<stdlib.h> void main() {     int arr[100],count[10],i,j;     clrscr();     for(i=0;i<20;i++)     {         arr[i]=random(10);     }     for(i=0;i<20; i++)     {         cout<<arr[i];         if(i%10==0)      ...

SKILL ROCKS TECH QUESTIONS

skillrocks technical interview question Q1 an array of 20 integer having digits 1 to 20 in random order, if we omit any one digit and replace it by zero find the number omitted. example |1|3|5|7|8|9|4|2|6|10|0|13|15|16|17|19|18|15|20|12|14| Q2 find the greatest no. from an array having random numbers of 100 size, with out sorting. Q3 find the frequency of 1 to 9 from an array of size 100 having value 1 to 9 randomly arranged Conditions: 1. use only one loop. 2. do not use counters. 3. most efficiently  Answer is waiting.....