9 Mar 2013

pattern_nested loops

/* program in c to print following pattern... &  &  &  &  &  &  &    &  &  &  &  &       &  &  &          & */   #include<stdio.h>#include<conio.h>void...

Categories: ,

ugly_number

/*program to generate nth ugly number Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ... shows the first 11 ugly numbers. By convention, 1 is included. */# include<stdio.h># include<stdlib.h>/*This function divides a by greatest divisible   power of b*/int...

Categories: ,

perfect_number

/*  program to check whether a given no. is a ""perfect no."" or not. a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself The first perfect number is 6 */ #include<iostream.h>#include<conio.h>void main(){clrscr();int...

Categories: ,

pattern_rectangle

/* program to print following pattern *********************** *                     * *                     * *                     * *                    ...

Categories: ,

Pattern_nested LOOP

/* program to generate following pattern......     *    ***   *****  ******* *********  */ #include<iostream.h>#include<conio.h>  void main(){clrscr();  int i,j,r,a=1;  for(i=1;i<=5;i++) {  for(j=5;j>i;j--)   {    cout<<" ";  ...

Categories: ,

8 Mar 2013

Palindrome_String

/* program to check whether a string is palindrome or not in c++ */ #include<iostream.h>#include<conio.h>#include<string.h>#include<stdio.h>void main(){clrscr();int i,j,k,flag=0;char a[80];cout<<"Enter the string:";gets(a);k=strlen(a);for(i=0,j=k-1;i<=j;i++,j--){if(a[i]!=a[j]){flag=1;break;}}if(flag>0)cout<<"String...

Categories: ,

graplin level-1 solved

/* solution to graplin inline challenge level-1 */ #include<stdio.h>#include<conio.h>#include<string.h>void cutstr(char *,int ,int );char arr1[150]={'\0'};char arr2[150]={'\0'};char arr11[]="FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetract";char...

Categories: ,

grapline level-2 solved

/*  solution to grapline online change level-2 *\ #include<stdio.h>#include<conio.h>int checkprime(int );void main(){long int n=514230,i,sum=0;for(i=2;i<n-1;i++)    {if(checkprime(i)!=0 && n%i==0)        {printf("\n%ld",i);           ...

Categories: ,

Fibonacci series

/*       program to generate Fibonacci series in C++.  */   #include<iostream.h>#include<conio.h>int main(){clrscr();unsigned long first,second,third,n;first=0; second=1;cout<<"How many elements(>5)?\n";cin>>n;cout<<"Fibonacci series\n";cout<<first<<" "<<second;for(int...

Categories: ,

Copyright © 2025 UPgradeCODING | Powered by Blogger